美文网首页
OC-SB的使用

OC-SB的使用

作者: ChaosHeart | 来源:发表于2023-10-29 17:24 被阅读0次

    1.创建storyBoard

    截屏2023-10-30 15.14.56.png
    截屏2023-10-31 11.57.37.png

    2.关联视图控制器

    截屏2023-10-31 11.59.05.png
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
       
        //创建Window
        _window = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].bounds];
        _window.backgroundColor = [UIColor whiteColor];
        [_window makeKeyAndVisible];
        
        //加载Storyboard(Main是文件名)
        UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        //(->)入口的控制器
        FirstTabBarController *first = [sb instantiateInitialViewController];
        //根据id关联并创建sb中的FirstTabBarController(指定的)
    //    FirstTabBarController *first = [sb instantiateViewControllerWithIdentifier:@"FirstTabBarController"];
        
        //指定根控制器
        _window.rootViewController = first;
        
        return YES;
    }
    
    

    1.添加导航控制器和标签控制器

    截屏2023-10-26 16.09.29.png

    2.添加控件

    截屏2023-10-26 16.10.03.png

    3.一个标签控制器可以关联四个导航控制器

    截屏2023-10-26 16.11.25.png
    截屏2023-10-26 16.10.52.png

    相关文章

      网友评论

          本文标题:OC-SB的使用

          本文链接:https://www.haomeiwen.com/subject/otdvidtx.html