iOS开发 ----- UI生命周期
来源:互联网 发布:淘宝评价截图怎么弄 编辑:程序博客网 时间:2024/06/10 13:04
APP生命周期
main函数
参数说明1. argc main函数的argc2. argv main函数的argv3. 传入一个类名,但这个类必须是UIApplication的子类 而这个函数会自动创建UIApplication子类的对象,如果是nil的话,则只创建UIApplication的对象4. 传入代理类的名字main函数开始后,维护了一个消息循环,可以说是一个死循环,知道应用手动退出或者由于内存不足而退出当程序界面发生改变后,会接到相关通知去处理相应的时间#import <UIKit/UIKit.h>#import "AppDelegate.h"int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); }}
程序运行过程
1.程序已经准备完成即将进入到界面上进行展示
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
2.此函数在app即将进入后台时调用,也就是双击home键时调用
- (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.}
3.此函数在app进入后台时调用,也就是切换了别的应用,或者被来电中断,则会调用
- (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.}
4.此函数在app即将进入前台时调用,这里可以放一些恢复界面的代码,
- (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.}
5.此函数在app进入前台后调用,已经可以和用户交互了
- (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.}
6.此函数会在app结束时调用
- (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.}
以上基本上就是app运行的基本流程
0 0
- iOS开发 ----- UI生命周期
- IOS开发UI-------视图的生命周期
- iOS开发UI篇-UIView的生命周期
- iOS开发视频教程 UI部分:9、应用程序的生命周期
- iOS开发—生命周期
- iOS开发:视图生命周期
- iOS开发-生命周期
- iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期
- iOS开发UI篇—UITabBarController生命周期(使用storyoard搭建)
- iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期
- iOS开发UI高级—15UITabBarController生命周期(使用storyoard搭建)
- iOS开发UI篇—0408控制器View的生命周期方法
- iOS开发UI高级—06使用storyboard创建导航控制器以及控制器的生命周期
- iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期
- iOS开发UI篇—UITabBarController生命周期(使用storyoard搭建)
- iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期
- IOS开发之IOS生命周期
- iOS: UI 开发
- PAT (Basic Level) Practise (中文) 1017. A除以B (20)
- UIday0601:UISegmentedControl的属性和用法
- 多线程安全问题及解决办法
- 字符设备驱动copy_to_usr
- 模板函数和模板类的区别
- iOS开发 ----- UI生命周期
- 链你妹系列1—关于链表,不得不吐槽的那些事
- 黑马程序员——网络编程
- 一个死锁程序
- 8月31日,即将迎来大学生活。以此记录我的编程博客之旅。
- iOS开发 ----- UILable
- 软件测试概念与基本流程
- 客户端项目框架【全局观】
- 对惠普实训的感想