参考链接:https://www.jianshu.com/p/b1352b483d85
本文只讨论纯代码方式的创建和加载
1.ViewController的加载
代码创建的ViewController:
ViewControllerWith *vc = [[ViewControllerWith alloc] init];
在这个加载过程中 相关方法调用顺序是:
init -->
initWithNibName:bundle: -->
loadView -->
viewDidLoad
2.view的加载
View加载的纯代码的方式:
MyView *view = [[MyView alloc] init];
在这个加载过程中 相关方法调用顺序是:
init -->
initWithFrame:
是init调用了initWithFrame:
网友评论