天天看点

如何实现app文件,第一次使用时的启动画面

//  Created by lyz on 15-8-24.

//  Copyright (c) 2015年 mac. All rights reserved.

//

#import "AppDelegate.h"

//#import "MainTabBarController.h"

#import "FastComeViewController.h"

#import "LunchViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Override point for customization after application launch.

     UIWindow *window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];

    window.backgroundColor = [UIColor whiteColor];

    self.window = window;

    [self.window makeKeyAndVisible];

    //创建标签控制器

    //先找文件,判断是否存在

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

    BOOL value = [defaults boolForKey:@"isnext"];

    if (value == YES)

    {// 不是第一次

        NSLog(@"不是第一次进入");

        UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Lunch" bundle:nil];

        LunchViewController *lunch = [storyBoard instantiateViewControllerWithIdentifier:@"Lunch"];

        self.window.rootViewController = lunch;

    }else{

       //第一次

        NSLog(@"第一次进入");

        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

         [defaults setBool:YES forKey: @"isnext"];

        //同步数据

        [defaults synchronize];

        FastComeViewController *tabarVC = [[FastComeViewController alloc]init];

        tabarVC.view.layer.transform = CATransform3DMakeScale(.5, .5, 0);

        self.window.rootViewController = tabarVC;

        [UIView animateWithDuration:1 animations:^{

            tabarVC.view.layer.transform = CATransform3DIdentity;

        }];

        //application.statusBarHidden = NO;

    }

    //状态栏

    [application setStatusBarStyle:UIStatusBarStyleLightContent];

    return YES;

}