tags:

views:

242

answers:

2

I want to create UI elements programmatically without using xib files. All of the examples I have found (UICatalog, ...) are creating UI elements directly in the controller methods. What is the best practice to keep up with MVC patternn and separate views from controllers?

Thanks

+2  A: 

If I understand the problem correctly, all you have to do is to create a separate view class that will take care of creating the UI elements. Then in the controller class you simply create an instance of the view class.

zoul
+1  A: 

zoul is correct in his answer. To aid you in doing this, these is a tool that will convert an XIB to the same Objective-C code it would take to create the view:

http://arstechnica.com/apple/guides/2009/04/iphone-dev-convert-xib-files-to-objective-c.ars

coob