I am currently updating an older app that is using ARC but not Storyboards. The app starts with an animated launch screen(well seamlessly animated after the launch screen has finished loading), since I started playing with the app in Xcode 6, when I launch the app, I see the loading screen appear, then I see a flash of the nav controller(root controller) then the animation starts. Normally, the app should load in that order --> Default screen --> Seamless animation --> nav controller
The animation works well, and the app loads correctly, it's just that gap between the default launch screen and the animation that I get a glimpse of the nav controller
I'm not entirely certain if it's an iOS issue or Xcode.
I'm adding the code here, anybody else having this issue?
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.tabBarController = [[UITabBarController alloc] init];
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
[self.tabBarController.tabBar setTintColor:[UIColor colorWithRed:0.1960784314 green:0.66666666669999997 blue:0.2784313725 alpha:1.0]];
[self.tabBarController.tabBar setBarTintColor:[UIColor blackColor]];
}
self.window.rootViewController = self.tabBarController;
NavigationController *navController1, *navController2, *navController3, *navController4, *navController5;
navController1 = [[NavigationController alloc] initWithRootViewController:[[ViewController1 alloc] initWithNibName:@"ViewController1" bundle:nil]];
navController2 = [[NavigationController alloc] initWithRootViewController:[[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil]];
navController3 = [[NavigationController alloc] initWithRootViewController:[[ViewController3 alloc] initWithNibName:@"ViewController3" bundle:nil]];
navController4 = [[NavigationController alloc] initWithRootViewController:[[ViewController4 alloc] initWithNibName:@"ViewController4" bundle:nil]];
navController5 = [[NavigationController alloc] initWithRootViewController:[[ViewController5 alloc] initWithNibName:@"ViewController5" bundle:nil]];
self.tabBarController.viewControllers = @[navController1, navController2, navController3, navController4, navController5];
[self.window makeKeyAndVisible];
// Display intro view controller
if (!launchOptions) {
IntroViewController *introController = [[XMWelcomeViewController alloc] initWithNibName:@"IntroViewController" bundle:nil];
[introController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self.tabBarController presentViewController:welcomeController animated:NO completion:nil];
}
return YES;
}
IntroViewController.m
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
XMLanguageType selectedLanguage = (XMLanguageType)[[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsLanguageKey];
NSString *languageIdentifier = nil;
switch (selectedLanguage) {
case XMLanguageTypeEnglish:
languageIdentifier = @"en";
break;
case XMLanguageTypeFrench:
languageIdentifier = @"fr";
break;
default:
break;
}
NSMutableArray *introImages = [NSMutableArray array];
// Add language specific animation images
for (int count = 1; count <= 13; count++) {
NSString *imageName;
if ([[UIScreen mainScreen] bounds].size.height == 568) {
imageName = [NSString stringWithFormat:@"intro_animation_%@%04d-586h@2x.jpg", languageIdentifier, count];
}
else {
imageName = [NSString stringWithFormat:@"intro_animation_%@%04d.jpg", languageIdentifier, count];
}
UIImage *image = [UIImage imageNamed:imageName];
[introImages addObject:image];
}
[self.imageViewTop setImage:introImages.lastObject];
[self.imageViewTop setAnimationImages:(NSArray *)introImages];
[self.imageViewTop setAnimationDuration:1.6];
[self.imageViewTop setAnimationRepeatCount:1];
[self.imageViewTop startAnimating];
// First Launch --> set update on startup to
if (![[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsFirstLaunchedOccured]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kUserDefaultsFirstLaunchedOccured];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kUserDefaultsUpdateOnStartupKey];
}
}