iOS开发UI篇—UITableBarController生命周期(使用storyoard搭建)
1 // 2 // YYbaseViewController.m 3 // 02-uitabbarcontroller 4 // 5 // Created by 孔医己 on 14-6-8. 6 // Copyright (c) 2014年 itcast. All rights reserved. 7 // 8 9 #import "YYbaseViewController.h" 10 11 @interface YYbaseViewController () 12 13 @end 14 15 @implementation YYbaseViewController 16 17 // 当控制器的view加载完毕就调用 18 - (void)viewDidLoad 19 { 20 [super viewDidLoad]; 21 NSLog(@"%@ - 控制器的view加载完毕", [self class]); 22 } 23 24 // 控制器即将显示的时候调用 25 - (void)viewWillAppear:(BOOL)animated 26 { 27 [super viewWillAppear:YES]; 28 NSLog(@"%@ - 控制器即将显示", [self class]); 29 } 30 31 // 控制器完全显示的时候调用 32 - (void)viewDidAppear:(BOOL)animated 33 { 34 [super viewDidAppear:animated]; 35 NSLog(@"%@ - 控制器完全显示", [self class]); 36 } 37 38 // 控制器即将消失的时候调用 39 - (void)viewWillDisappear:(BOOL)animated 40 { 41 [super viewWillDisappear:animated]; 42 NSLog(@"%@ - 控制器即将消失", [self class]); 43 } 44 // 控制器完全消失的时候调用 45 - (void)viewDidDisappear:(BOOL)animated 46 { 47 [super viewDidDisappear:animated]; 48 NSLog(@"%@ - 控制器完全消失", [self class]); 49 } 50 51 - (void)viewWillUnload 52 { 53 [super viewWillUnload]; 54 NSLog(@"%@ - view即将被销毁", [self class]); 55 } 56 57 - (void)viewDidUnload 58 { 59 [super viewDidUnload]; 60 NSLog(@"%@ - view完全被销毁", [self class]); 61 } 62 63 - (void)dealloc 64 { 65 NSLog(@"%@", [self class]); 66 } 67 68 @end
- (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. UITabBarController *tb=(UITabBarController*)self.window.rootViewController; NSLog(@"%@",NSStringFromCGRect(tb.tabBar.frame)); }
打印结果为:
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。