creating single view with elements created programmatically and loaded from nib
I like using nib files to configure some subviews, but for other subviews i prefer to create them programmatically. What is the preferred method to programmatically add elements into a view loaded from a nib or change开发者_如何转开发 element properties? Right now I do it in viewWillAppear.
-(void)viewDidLoad
is the correct location for these customizations. And for removing any references to these customizations do so in -(void)viewDidUnload
. Doing so in viewWillAppear may cause you to end up with multiple copies of you added elements since it is called each time the view is shown, especially in a UINavigationController
.
精彩评论