iOS開發-生命週期
iOS開發-生命週期
應用生命週期
首次啟動Not running→Inactive→Active
呼叫didFinishLaunchingWithOptions,applicationDidBecomeActive
應用結束Active → Inactive → Background→Suspended→Not running
呼叫applicationWillResignActive,applicationDidEnterBackground,applicationWillTerminate
應用重新執行Suspended → Background → Inactive → Active
呼叫applicationWillEnterForeground,applicationDidBecomeActive
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSLog(@"%@",@"didFinishLaunchingWithOptions");
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
NSLog(@"%@",@"applicationWillResignActive");
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
NSLog(@"%@",@"applicationDidEnterBackground");
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
NSLog(@"%@",@"applicationWillEnterForeground");
}
- (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.
NSLog(@"%@",@"applicationDidBecomeActive");
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
NSLog(@"%@",@"applicationWillTerminate");
}
檢視生命週期
// 檢視建立
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"%@",@"viewDidLoad");
}
// 檢視即將可見
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
NSLog(@"%@",@"viewWillAppear");
}
// 檢視已經可見
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
NSLog(@"%@",@"viewDidAppear");
}
// 檢視即將不可見
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
NSLog(@"%@",@"viewWillDisappear");
}
// 檢視已經不可見
- (void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
NSLog(@"%@",@"viewDidDisappear");
}
// 低記憶體警告
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
NSLog(@"%@",@"didReceiveMemoryWarning");
}
// 檢視銷燬
- (void)viewDidUnload{
[super viewDidUnload];
NSLog(@"%@",@"viewDidUnload");
}
相關文章
- IOS開發之UIController生命週期iOSUIController
- iOS App生命週期iOSAPP
- iOS APP的生命週期iOSAPP
- iOS開發筆記(九):UIViewController的生命週期iOS筆記UIViewController
- 開發方法---軟體生命週期
- mpvue小程式開發 - 生命週期梳理Vue
- 安全的軟體開發生命週期
- iOS開發之UIView與UIViewController的生命週期總結iOSUIViewController
- 安全軟體開發生命週期簡介
- 軟體開發的生命週期過程
- iOS 生命週期的缺失和錯亂iOS
- Java開發學習(五)----bean的生命週期JavaBean
- Ixia為開發者重塑軟體開發生命週期
- View生命週期與Activity生命週期的關係View
- iOS執行緒生命週期的監控iOS執行緒
- iOS 檢視控制器的生命週期iOS
- PHP 生命週期PHP
- Flutter - 生命週期Flutter
- sessionStorag 生命週期Session
- Fragment生命週期Fragment
- Activity生命週期
- vue - 生命週期Vue
- React生命週期React
- ubuntu生命週期Ubuntu
- React 生命週期React
- vue生命週期Vue
- iOS初級開發學習筆記:APP生命週期的學習總結iOS筆記APP
- 軟體安全開發生命週期讀書筆記筆記
- Salesforce 生命週期管理(一)應用生命週期淺談Salesforce
- iOS-APP的啟動流程和生命週期iOSAPP
- iOS10 UI教程檢視的生命週期iOSUI
- 微信小程式Taro開發(2):生命週期及開發中注意點微信小程式
- Activity生命週期onDestroy
- Flutter -- Element生命週期Flutter
- Flutter 的生命週期Flutter
- SQL的生命週期SQL
- java servlet 生命週期JavaServlet
- React-生命週期React