AppDelegate
- 应用程序启动,并进行初始化时调用该方法:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)
- 应用程序进入前台并处于活动状态时调用:
func applicationDidBecomeActive(application: UIApplication)
- 应用程序从活动状态进入到非活动状态:
func applicationWillResignActive(application: UIApplication)
- 应用程序进入到后台时候调用的方法:
func applicationDidEnterBackground(application: UIApplication)
- 应用程序进入到前台时候调用的方法:
func applicationWillEnterForeground(application: UIApplication)
- 应用程序将被终止的时候调用:
func applicationWillTerminate(application: UIApplication)
ViewController
loadView→viewDidLoad→viewWillAppear→viewDidAppear→viewWillDisappear→viewDidDisappear→dealloc
- loadView:一般情况下不用用到,除非需要重写设置View;
- viewDidLoad/dealloc:视图加载完成之后的设置和视图销毁的时候调用;
- viewWillAppear/viewWillDisappear:视图即将呈现和视图即将消失;
- viewDidAppear/viewDidDisappear:视图展现在屏幕的时候和视图完全消失在屏幕的时候调用,默认不做任何操作;
网友评论