您当前的位置: 首页 >  ar

white camel

暂无认证

  • 1浏览

    0关注

    442博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

iOS 一一 根据storyBoard加载window根控制器的View

white camel 发布时间:2017-08-25 16:42:12 ,浏览量:1

1.加载指定的storyBoard

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

2.加载箭头所指向的控制器.

UIViewController *vc = [storyBoard instantiateInitialViewController];

3.加载指定标识的控制器.

UIViewController *vc = [storyBoard instantiateViewControllerWithIdentifier:@"VCStoryBoardID"];

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // 通过storyBoard加载控制器(通过storyBoard来加载Window根控制器的view)
    
    //1. 创建窗口
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    //2. 设置窗口的根控制器
    //2.1创建storyBoard对象
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    
    //2.2 加载storyBoard箭头指向的控制器
//    UIViewController *vc = [storyBoard instantiateInitialViewController];
    //2.3 加载storyBoard中指定的控制器
    UIViewController *vc = [storyBoard instantiateViewControllerWithIdentifier:@"ZY"];
    self.window.rootViewController = vc;
    
    //3. 显示窗口
    [self.window makeKeyAndVisible];
    
    
    return YES;
}

关注
打赏
1661428283
查看更多评论
立即登录/注册

微信扫码登录

0.2006s