Search code examples
iphoneobjective-ccocoacocoa-touchios4

When should I create a view controller programmatically, and when should I use a NIB file?


I am trying to programmatically create a view controller. I would like to know when I should create the view controller using a NIB file, and when I should create it programmatically.

I would also like step-by-step instructions to create the view controller without a NIB file.


Solution

  • Personally, I like to use IB for ViewControllers that contain mostly static views. When a ViewController has a lot of views that I need to create dynamically, or animate I prefer to create the ViewController with code.