引导页展示---

来源:互联网 发布:移动网络的虚拟运营商 编辑:程序博客网 时间:2024/06/06 03:58
- (void)startRootViewController {    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];    if (![[NSUserDefaults standardUserDefaults] boolForKey:@"isNotFirstInit"]) {        //第一次启动引导页面        NSLog(@"wanggsx:第一次启动");        UIStoryboard *FisrtInitRouter =[UIStoryboard storyboardWithName:@"FisrtInitRouter" bundle:[NSBundle mainBundle]];        UINavigationController  *rootVC =[FisrtInitRouter instantiateViewControllerWithIdentifier:@"FisrtInitRouter"];        self.window.rootViewController = rootVC;//        [self.window addSubview:rootVC.view];    }    else    {        //打开选择主页        [self switchRootViewController];    }    [self.window makeKeyAndVisible];}//切换RootViewController- (void)switchRootViewController{    UIStoryboard *main =[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];    UITabBarController *rootVC =[main instantiateViewControllerWithIdentifier:@"MotoTabBarViewController"];    self.window.rootViewController = rootVC;}

引导完成点击的按钮

- (IBAction)startExperience:(UIButton *)sender {//    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"firstLaunch"];    AppDelegate *appDelegate=[UIApplication sharedApplication].delegate;    [appDelegate switchRootViewController];}
0 0
原创粉丝点击