UIWindow
1.UIWindow是APP的窗口視圖,所有的展示內(nèi)容都是在window中的
2.常用方法
//設(shè)置tabbar為window的根控制器
self.window.rootViewController = [[UITabBarController alloc]init];
//將單個界面設(shè)置為根控制器
self.window.rootViewController = [[UINavigationController alloc]init];
UITabBarController
1.UITabBarController是控制App內(nèi)有幾個大模塊的控制中心(最多5個),單個模塊的圖標(biāo),標(biāo)題由該控制器控制(大部分情況下需要重寫)
2.常用Api
//創(chuàng)建tabbarController
UITabBarController *tabbarVC = [[UITabBarController alloc] init];
//設(shè)置單個模塊
UIViewController *vc = [[UIViewController alloc] init];
vc.title = @"首頁";
vc.tabBarItem.image = [UIImage imageNamed:@"home"];//設(shè)置為選中是的圖片
vc.tabBarItem.selectedImage = [UIImage imageNamed:@"home_sec"];//設(shè)置選中是的圖片
//創(chuàng)建導(dǎo)航欄控制器,并將第一個UIViewController設(shè)置為根控制器
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
//將單個模塊添加到UITabBarController中
[tabbarVC addChildViewController:nav];
UINavigationController
1.UINavigationController是界面跳轉(zhuǎn)的控制中心,iOS界面跳轉(zhuǎn)有兩種方式,Push&&模態(tài)
2.常用Api
//創(chuàng)建UINavigationController
UIViewController *vc = [[UIViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
//push跳轉(zhuǎn)
[nav pushViewController:vc animated:YES];
//pop返回
[nav popToRootViewControllerAnimated:YES];
//模態(tài)跳轉(zhuǎn)
[nav presentViewController:vc animated:YES completion:nil];
//模態(tài)返回
[vc dismissViewControllerAnimated:NO completion:nil];
UIViewController
- UIViewController具備控制界面的展示,處理界面里控件的點擊事件等功能
2.常用Api
UIViewController *vc = [[UIViewController alloc] init];