2

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 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.