控制器view及UIApplication的生命周期
生活随笔
收集整理的這篇文章主要介紹了
控制器view及UIApplication的生命周期
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
一、控制器View的生命周期:
/*** view加載完畢*/- (void)viewDidLoad{[super viewDidLoad];NSLog(@"ICKOneViewController-viewDidLoad");}/*** view即將顯示到window上**/- (void)viewWillAppear:(BOOL)animated{[super viewWillAppear:animated];NSLog(@"ICKOneViewController-viewWillAppear");}/*** view顯示完畢(已經(jīng)顯示到窗口)*/- (void)viewDidAppear:(BOOL)animated{[super viewDidAppear:animated];NSLog(@"ICKOneViewController-viewDidAppear");}/*** view即將從window上移除(即將看不見)**/- (void)viewWillDisappear:(BOOL)animated{[super viewWillDisappear:animated];NSLog(@"ICKOneViewController-viewWillDisappear");}/*** view從window上完全移除(完全看不見)**/- (void)viewDidDisappear:(BOOL)animated{[super viewDidDisappear:animated];NSLog(@"ICKOneViewController-viewDidDisappear");}--------------------------------------------------------------------------------------------------------------------------------------------------------/*** view即將銷毀的時候調(diào)用*/- (void)viewWillUnload{[super viewWillUnload];}/*** view銷毀完畢的時候調(diào)用*/- (void)viewDidUnload{[super viewDidUnload];// 由于控制器的view已經(jīng)不在了,需要顯示在view上面的一些數(shù)據(jù)也不需要self.apps = nil;self.persons = nil;// // [self.apps release];// [self.persons release]; }/*** 當(dāng)接收到內(nèi)存警告的時候*/- (void)didReceiveMemoryWarning{[super didReceiveMemoryWarning];}?
二、application的生命周期:
// 1、程序啟動完成的時候調(diào)用- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {NSLog(@"%s",__func__);return YES;}// 2、當(dāng)app失去焦點的時候調(diào)用- (void)applicationWillResignActive:(UIApplication *)application {NSLog(@"%s",__func__);}// 3、app進入后臺的時候調(diào)用// app忽然打斷的時候,在這里保存一些需要用到的數(shù)據(jù)- (void)applicationDidEnterBackground:(UIApplication *)application {NSLog(@"%s",__func__);}// 4、app進入即將前臺- (void)applicationWillEnterForeground:(UIApplication *)application {NSLog(@"%s",__func__);}// 5、當(dāng)app獲取到焦點的時候調(diào)用,意味著app可以與用戶交互- (void)applicationDidBecomeActive:(UIApplication *)application {NSLog(@"%s",__func__);}// 6、app被關(guān)閉的時候調(diào)用- (void)applicationWillTerminate:(UIApplication *)application {NSLog(@"%s",__func__);}// 7、app接收到內(nèi)存警告的時候調(diào)用// 清空圖片的緩存- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application{NSLog(@"%s",__func__);}?
轉(zhuǎn)載于:https://www.cnblogs.com/jfckliving/p/4778433.html
總結(jié)
以上是生活随笔為你收集整理的控制器view及UIApplication的生命周期的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 我想吐槽“吐槽 Google 换新 Lo
- 下一篇: 动态输出html一些效果失效的处理