标签:
1 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 2 // Override point for customization after application launch. 3 4 // 设置window 5 self.window = [[UIWindow alloc] init]; 6 self.window.frame = [[UIScreen mainScreen] bounds]; 7 self.window.backgroundColor = [UIColor grayColor]; 8 [self.window makeKeyAndVisible]; 9 10 11 // 设置一个UITabBarController 12 UITabBarController *tabBarController = [[UITabBarController alloc] init]; 13 self.window.rootViewController = tabBarController; 14 15 // 添加子控制器 16 UIViewController *c1 = [[UIViewController alloc] init]; 17 c1.view.backgroundColor = [UIColor redColor]; 18 // [tabBarController addChildViewController:c1]; 19 20 UIViewController *c2 = [[UIViewController alloc] init]; 21 c2.view.backgroundColor = [UIColor blueColor]; 22 // [tabBarController addChildViewController:c2]; 23 24 UIViewController *c3 = [[UIViewController alloc] init]; 25 c3.view.backgroundColor = [UIColor greenColor]; 26 27 tabBarController.viewControllers = @[c1,c2,c3]; 28 29 30 return YES; 31 }
1 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 2 // Override point for customization after application launch. 3 4 // 设置window 5 self.window = [[UIWindow alloc] init]; 6 self.window.frame = [[UIScreen mainScreen] bounds]; 7 self.window.backgroundColor = [UIColor grayColor]; 8 [self.window makeKeyAndVisible]; 9 10 11 // 设置一个UITabBarController 12 UITabBarController *tabBarController = [[UITabBarController alloc] init]; 13 self.window.rootViewController = tabBarController; 14 15 // 添加子控制器 16 UIViewController *c1 = [[UIViewController alloc] init]; 17 c1.view.backgroundColor = [UIColor redColor]; 18 c1.tabBarItem.title = @"红色"; 19 // [tabBarController addChildViewController:c1]; 20 21 UIViewController *c2 = [[UIViewController alloc] init]; 22 c2.view.backgroundColor = [UIColor blueColor]; 23 c2.tabBarItem.title = @"蓝色"; 24 // [tabBarController addChildViewController:c2]; 25 26 UIViewController *c3 = [[UIViewController alloc] init]; 27 c3.view.backgroundColor = [UIColor greenColor]; 28 c3.tabBarItem.title = @"绿色"; 29 30 tabBarController.viewControllers = @[c1,c2,c3]; 31 32 33 return YES; 34 }
1 - (void)viewDidLoad { 2 [super viewDidLoad]; 3 NSLog(@"%@ - viewDidLoad", self.class); 4 } 5 6 - (void)viewWillAppear:(BOOL)animated { 7 [super viewWillAppear:animated]; 8 NSLog(@"%@ - viewWillAppear", self.class); 9 } 10 11 - (void)viewDidAppear:(BOOL)animated { 12 [super viewDidAppear:animated]; 13 NSLog(@"%@ - viewDidAppear", self.class); 14 } 15 16 - (void) viewWillDisappear:(BOOL)animated { 17 [super viewWillDisappear:animated]; 18 NSLog(@"%@ - viewWillDisappear", self.class); 19 } 20 21 - (void)viewDidDisappear:(BOOL)animated { 22 [super viewDidDisappear:animated]; 23 NSLog(@"%@ - viewDidDisappear", self.class); 24 } 25 26 27 - (void)didReceiveMemoryWarning { 28 [super didReceiveMemoryWarning]; 29 NSLog(@"%@ - didReceiveMemoryWarning", self.class); 30 } 31 32 - (void)viewWillUnload { 33 [super viewWillUnload]; 34 NSLog(@"%@ - viewWillUnload", self.class); 35 } 36 37 - (void)viewDidUnload { 38 [super viewDidUnload]; 39 NSLog(@"%@ - viewDidUnload", self.class); 40 }
[iOS基础控件 - 6.12.1] QQ菜单管理 UITabBarController 控制器管理
标签:
原文地址:http://www.cnblogs.com/hellovoidworld/p/4189452.html