WatchOS系统开发大全(4)-WatchApp生命周期
生活随笔
收集整理的這篇文章主要介紹了
WatchOS系统开发大全(4)-WatchApp生命周期
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
WatchOSAPP生命周期
1.1-簡(jiǎn)介
-
WatchOS2.0之后的工程與WatchOS1.0的工程有什么不同之處?
-
創(chuàng)建的方式不同
-
2.0的工程多了一個(gè)文件:ExtensionDelegate
-
0700.png
-
ExtensionDelegate文件是干嘛用的?
- 用于管理應(yīng)用的生命周期(能夠獨(dú)立運(yùn)行)
-
WatchOS1.0沒有應(yīng)用的生命周期,只有WKInterfaceController的生命周期
-
Controller的生命周期和應(yīng)用的生命周期有什么區(qū)別?
-
controller的生命周期是管理每一個(gè)界面的生命周期
-
應(yīng)用的生命周期是管理整個(gè)App的生命周期
-
1.2-API
//應(yīng)用加載時(shí)會(huì)調(diào)用func applicationDidFinishLaunching() {// Perform any final initialization of your application.print(__FUNCTION__)}//應(yīng)用激活時(shí)會(huì)調(diào)用(進(jìn)入前臺(tái))func applicationDidBecomeActive() {// 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.print(__FUNCTION__)}//應(yīng)用失活時(shí)會(huì)調(diào)用(退到后臺(tái))func applicationWillResignActive() {// 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, etc.print(__FUNCTION__)}- WatchApp的生命周期沒有iPhoneApp的生命周期那么復(fù)雜,只有三個(gè)方法
總結(jié)
以上是生活随笔為你收集整理的WatchOS系统开发大全(4)-WatchApp生命周期的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: WatchOS系统开发大全(3)-创建第
- 下一篇: WatchOS系统开发大全(5)-WKI