遇到别人留下的storyboard的,你需要一个引导图,但是不知道怎么跳转.
2016-07-09 13:35
302 查看
首先在AppDeledate.m文件里是这样.
然后如果你是第一次实用程序
在你的
{ self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; if (![[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { [[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"firstLaunch"]; // NSLog(@"第一次启动"); //如果是第一次启动的话,使用UserGuideViewController(用户引导页面) 作为根视图 UserGuideViewController *userViewController=[[UserGuideViewController alloc]init]; self.window.rootViewController=userViewController; }else{ NSLog(@"不是第一次启动"); [self showHomeViewController]; } //跳转到Main - (void)showHomeViewController { [[UIApplication sharedApplication]setStatusBarHidden:NO]; UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; self.window.rootViewController = [storyBoard instantiateInitialViewController]; }
然后如果你是第一次实用程序
在你的
UserGuideViewController.m文件里
//按钮的触发时间 -(void)firstpressed{ //跳转至正文 [[UIApplication sharedApplication]setStatusBarHidden:NO]; UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; [self presentViewController:[storyBoard instantiateInitialViewController] animated:YES completion:nil]; }
相关文章推荐
- php示例代码之 使用PHP的MySQL标准函数
- 通过ObjectAnimator动画显示数字
- Node.js 文件夹目录结构创建
- matlab实现hog特征
- java基础知识回顾---单例模式的三种实现
- 第七次CCF-D:游戏
- Shader例子(1) 高光效果(surf/顶点)
- js数组去重
- 进入本网页后自动执行本方法
- CSS中display:block属性的作用
- 安卓手册 第四章(MVP介绍和实战)
- leetcode: Missing Number
- CentOS 6.3下PostgreSQL 的安装与配置
- cuda内存处理及stream内存处理
- php示例代码之类似于C#中的String.Format方法
- ucos-II之就绪表解读
- ContentProvider
- FreeCodeCamp练习二
- make学习笔记(一)
- MySQL索引背后的数据结构及算法原理