执行场景:
- 声明一个带有WKWebView的类MAWebViewController;
- 推入一个MAWebViewController的实例为0x12e0a0560;
- 下面的log发生在,再推入一个实例为0x12e49d130的MAWebViewController的过程中。
控制台Log:
2020-08-27 20:15:35.521805+0800 ####[12663:1967627] <MAWebViewController: 0x12e49d130>----->>willMoveToParentViewController
2020-08-27 20:15:35.552006+0800 ####[12663:1967627] <MAWebViewController: 0x12e49d130>----->>viewDidLoad
2020-08-27 20:15:35.554390+0800 ####[12663:1967627] <MAWebViewController: 0x12e0a0560>----->>viewWillDisappear
2020-08-27 20:15:35.554721+0800 ####[12663:1967627] <MAWebViewController: 0x12e49d130>----->>viewWillAppear
2020-08-27 20:15:36.107323+0800 ####[12663:1967627] <MAWebViewController: 0x12e0a0560>----->>viewDidDisappear
2020-08-27 20:15:36.107579+0800 ####[12663:1967627] <MAWebViewController: 0x12e49d130>----->>viewDidAppear
2020-08-27 20:15:36.107700+0800 ####[12663:1967627] <MAWebViewController: 0x12e49d130>----->>didMoveToParentViewController
2020-08-27 20:15:36.198475+0800 ####[12663:1967627] -[MAWebView webView:didFinishNavigation:] [Line 104] -[MAWebView webView:didFinishNavigation:]
很容易看出controller的命名周期,及其之间的交错叠加。
网友评论