[Swift]UIViewController
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤微信公众号:山青咏芝(let_us_code)
➤博主域名:https://www.zengqiang.org
➤GitHub地址:https://github.com/strengthen/LeetCode
➤原文地址:https://www.cnblogs.com/strengthen/p/13557809.html
➤如果链接不是山青咏芝的博客园地址,则可能是爬取作者的文章。
➤原文已修改更新!强烈建议点击原文地址阅读!支持作者!支持原创!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
1 import UIKit 2 3 class StandardViewController: UIViewController { 4 5 //1、视图即将显示 6 override func viewWillAppear(_ animated: Bool) { 7 super.viewWillAppear(animated) 8 9 } 10 11 //2、UIKit将更新当前布局边距 12 @available(iOS 11.0, *) 13 override func viewLayoutMarginsDidChange() { 14 super.viewLayoutMarginsDidChange() 15 16 } 17 18 //3、UIKit将更新安全区域内边距 19 @available(iOS 11.0, *) 20 override func viewSafeAreaInsetsDidChange() { 21 super.viewSafeAreaInsetsDidChange() 22 23 } 24 25 //4、将要布局子空间 26 override func viewWillLayoutSubviews() { 27 super.viewWillLayoutSubviews() 28 29 } 30 31 //5、已布局子空间 32 override func viewDidLayoutSubviews() { 33 super.viewDidLayoutSubviews() 34 35 } 36 37 //6、视图已经出现 38 override func viewDidAppear(_ animated: Bool) { 39 super.viewDidAppear(animated) 40 } 41 42 //7、最后即将显示视图 43 override func viewDidLoad() { 44 super.viewDidLoad() 45 // Do any additional setup after loading the view. 46 47 } 48 49 //8、视图即将消失 50 override func viewWillDisappear(_ animated: Bool) { 51 super.viewWillDisappear(animated) 52 53 } 54 55 //9、视图已消失 56 override func viewDidDisappear(_ animated: Bool) { 57 super.viewDidDisappear(animated) 58 59 } 60 /* 61 // MARK: - Navigation 62 63 // In a storyboard-based application, you will often want to do a little preparation before navigation 64 override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 65 // Get the new view controller using segue.destination. 66 // Pass the selected object to the new view controller. 67 } 68 */ 69 }