views:

31

answers:

1

I have a question regarding setting up a simple single view application. From what I can see there are two methods...

METHOD_001

  1. Start Xcode and create a "Window Based Application"
  2. Start setting up your interface in the MainWindow.xib

METHOD_002

  1. Start Xcode and create a "Window Based Application"
  2. In Xcode add a UIViewController subclass with its own XIB.
  3. In Xcode add an IBOutlet to the delegate to point to UIViewController
  4. In Interface Builder add an instance of UIViewController and link it at the delegate
  5. In Interface Builder select the "NIB Name" the UIViewController will use.

To my mind METHOD_002 would seem to be the way to go for anything other than the most simple of tests. Also its following the MVC methodology, so I would suggest that METHOD_001 is just a starting point and you should always be heading towards METHOD_002?

gary

+1  A: 

Between the two alternatives, the second one looks better for the simple reason that it has more loose coupling, probably making it easier to switch things around later. I'm not sure you could say that it's more MVC, because at this point you don't yet have any model objects, and even with the first method you have both a view controller and a view.

Felixyz
Thank you, my initial tests with the iPhone did revolve around Method_001, but like you say now I am more familiar with the platform I am finding it easier (and nicer design wise) to set thing up more in line with Method_002.
fuzzygoat