[HW1] 1.了解IOS生命週期

Jameskrauser Lee
2 min readFeb 21, 2018

--

1.了解IOS生命週期

AppDelegate

Not running:
應用程式還沒有啟動,或是應用程式正在運行但是途中被系統停止

Inactive:
己前台運行,但不接收事件(當前或許在執行其他代碼)。

Active:
己在前台運行,可以接收事件。
這是應用程式在前台運行時所處的正常狀態。

Background:
己在後台運行,可以執行代碼。
大多數情況,進入Suspended前,會短暫進入此狀態。

Suspended:
不在後台,並且己停止執行代碼。
此狀態,應用程式依然駐留在內存但不執行任何代碼。
如果系統內存不夠,應用程式會被終止。

step1. init 初始化
step2. loadView 從nib載入視圖
step3. viewDidLoad 載入完成
step4. viewWillAppear 視圖出現在屏幕之前
step5. viewDidAppear 渲染完成 顯示在屏幕上
step6. viewWillDisappear 從屏幕移除之前
step7. viewDidDisppear
step8. viewWillunload
step9. viewDidUnload
step10. dealloc 被銷毀

reference Data
https://medium.com/@ChunYeung/swift-%E8%AB%87%E8%AB%87%E5%B9%BE%E5%80%8B%E9%87%8D%E8%A6%81%E7%9A%84-ios-app-life-cycle-%E7%94%9F%E5%91%BD%E9%80%B1%E6%9C%9F-93380fe93d95

http://www.itread01.com/articles/1478414444.html

2.用Table view建一組清單,然後點下去後,會連到某個網頁

assign time : 20170221 15PM
finish time : 20170222 10AM
SourceCode : https://github.com/jameskrauser/HW1_TableviewWebview

Swift version
Demo

table View show the company name
click apple will connect to apple url
click htc will connect to htc url
App Transport Security Settings / Allow Arbitrary Loads = YES , now App can connect to Others URL
you will get the indexPath when you click web view
use the myindex to dynamic show url

--

--

Jameskrauser Lee
Jameskrauser Lee

Written by Jameskrauser Lee

For the last few years. i was involved mostly in the development of Automatic Fare collection system for the Chennai Metro. Familiar with C++ and iOS.

No responses yet