Tuesday, January 28, 2014

Splash Screen flicker on Titanium (TiRootViewController)

While developing an iOS application I had a problem with splash screen which flickers for a certain instance.After searching and posting questions on forum I didn't succeed,so I have to edit the TiRootViewController.


    if([TiUtils isIOS7OrGreater])
    {
        CGRect testFrame = [[UIScreen mainScreen] applicationFrame];
        testFrame.origin.y = -20;
        testFrame.size.height = testFrame.size.height+40;
        newFrame = testFrame;
    }else
    {
        if ((imageSize.width == newFrame.size.width))
        {
            CGFloat overheight;
            overheight = imageSize.height - newFrame.size.height;
            if (overheight > 0.0) {
                newFrame.origin.y -= overheight;
                newFrame.size.height += overheight;
            }
        }
    }

 [defaultImageView setContentMode:contentMode];
 [defaultImageView setImage:defaultImage];
 [defaultImageView setFrame:newFrame];