问题描述
我知道这里的问题似乎完全相同:但是,我已经阅读了该问题,但仍未得到完全回答.我不使用IB,因为UI是动态的.
I know there is a seemingly exact duplicate of this question here: iPhone SDK: what is the difference between loadView and viewDidLoad?However, I have read that question and still it was not fully answered. I'm not using IB as the UI is dynamic.
因此,我应该创建self.view,然后在loadView中添加子视图.
So should I create the self.view and then add the subviews in loadView.
还是我应该在loadView中创建self.view并在viewDidLoad中添加子视图?#
or should I create the self.view in loadView and add the subviews in viewDidLoad?#
推荐答案
从NIB加载视图并希望在启动后执行进一步的自定义时,请使用viewDidLoad.
When you load your view from a NIB and want to perform further customization after launch, use viewDidLoad.
如果要以编程方式创建视图(不使用Interface Builder),请使用loadView.
If you want to create your view programatically (not using Interface Builder), use loadView.
这篇关于loadView和viewDidLoad有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!