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.
1 Answer
-(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.