IOS 8:动画启动屏幕在Xcode 6中延迟

时间:2014-11-21 06:17:23

标签: ios objective-c xcode ios8

我目前正在更新使用ARC而不是故事板的旧应用。该应用程序以动画启动屏幕开始(在启动屏幕完成加载后无缝动画),因为我开始使用Xcode 6中的应用程序,当我启动应用程序时,我看到加载屏幕出现,然后我看到一个闪光灯导航控制器(根控制器)然后动画开始。通常,应用程序应按此顺序加载 - >默认屏幕 - >无缝动画 - >导航控制器

动画效果很好,应用程序正确加载,这只是默认启动画面和动画之间的差距,我可以一瞥导航控制器

我不完全确定它是iOS问题还是Xcode。

我在这里添加代码,其他人有这个问题吗?

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];
    }
}

0 个答案:

没有答案
相关问题