Jump to content

iPhone SDK Beta 3 iPhone 101 Tutorial


1 post in this topic

Recommended Posts

This goes out to anyone who has gone though the iPhone101 tutorial that came with the newest release of the iPhone SDK. Putting the typos and errors aside (especially the magical 'self.string' instance that they made up) there appears to be some odd design patterns in action there.

 

First up is the applicationDidFinishLaunching method. The code the provide is:

MyViewController *aViewController = [[MyViewController alloc] init];
self.myViewController = aViewController;
[aViewController release];

 

Unless I'm missing something, this could have easily been replaced by:

self.myViewController = [[MyViewController alloc] init];

 

Is there any advantage to creating a ViewController, assigning it to the AppDelegate and then releasing it? Could this be because myViewControllers set method retains a copy so using the single line approach will keep 2 copies alive? EDIT: It appears to be that there are 2 copies if done with the single file method due to the fact that myViewController is set to retain.

 

Next up is that they have you making separate ViewControllers and then using the loadView method to load up a nib that contains just a view. Wouldn't it be easier to have your MainWindow nib have a couple ViewController each with their own UIView already ready to go? Is there an advantage in having all of your views be separate nibs? (besides the obvious one if you have a huge application and memory management dictates that multiple nibs is the only way to go)

 

How is everyone else here designing your apps? Are you doing it the iPhone101 way with lots of nibs or are you utilizing the MainWindow nib file to house a few ViewControllers?

Link to comment
Share on other sites

 Share

×
×
  • Create New...