OC-SB的使用
2023-10-29 本文已影响0人
ChaosHeart
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.png2.添加控件
截屏2023-10-26 16.10.03.png3.一个标签控制器可以关联四个导航控制器
截屏2023-10-26 16.11.25.png截屏2023-10-26 16.10.52.png