On iOS 7, launch images fade out instead of disappearing immediately when the app is loaded.
Is there any setting to prevent this launch image fade out animation?
In iOS 7, the splash screen fade-transitions from the splash image to your first UIView. If that UIView looks identical to the splash screen, you see no fade. The problem is that Cocos2D's initial view is pure black.
Unfortunately, the only way I found to resolve this was to actually add a UIImageView identical to the splash image for a second, then remove it once Cocos2D started drawing.
In CCDirectorIOS (or your subclass):
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_WIDESCREEN (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height > 567.0f)
static const NSInteger tempSplashViewTag = 87624;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSString *spriteName = IS_IPAD ? @"Default-Landscape" : IS_WIDESCREEN ? @"Default-568h" : @"Default";
UIImageView *splashView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:spriteName]];
splashView.tag = tempSplashViewTag;
[self.view addSubview:splashView];
[self startAnimation];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
UIView *splashView = [self.view viewWithTag:tempSplashViewTag];
[splashView removeFromSuperview];
});
}