Skip navigation.
 
mlRe: [Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?
FROM : Waqar Malik
DATE : Mon Jul 14 22:34:44 2008

<http://lists.apple.com/archives/Xcode-users/2008/Jul/msg00276.html>

Still under NDA.

--Waqar
On Jul 14, 2008, at 3:15 PM, JongAm Park wrote:

> Hello, all.
>
> Because the final SDK for the iPhone came out, I started to take a 
> look at it.
> Although I knew that Window/View hierarchies are different on the 
> Mac and the iPhone, I found that there were some fundamental 
> difference in programming model.
>
> For example, this code from http://developer.apple.com/iphone/gettingstarted/docs/creatingiphoneapps.action
> ,
> it creates a view controller and add its view as a window's sub view.
>
> Listing 2. Creating the content view
>
> - (void) applicationDidFinishLaunching:(UIApplication *)application
> {
>  // Set up the view controller
>  UIViewController *aViewController = [[UIViewController alloc] 
> initWithNibName:@"MoveMeView"
>                                                                                                                      bundle
> :[NSBundle mainBundle]];
>  self.viewController = aViewController;
>  [aViewController release];
>
>  // Add the view controller's view as a subview of the window
>  UIView *controllersView = [viewController view];
>  [window addSubView:controllersView];
>  [window makeKeyAndVisible];
> }
>
>
> However, for the Mac, something like the view controller was not 
> necessary, right? and a content view is not added manually like the 
> code above. ( I don't mean that "Oh, there is no UIViewController 
> and UIView". I know that those are made for the iPhone. )
> When a window and its view are made using the Interface Builder, 
> they were handled automatically for the Mac.
> Isn't this true for the iPhone?
>
> (Well, I just looked up "NSViewController" document and it says that 
> it was added to the Leopard.
> Is there any document which explains why it is added and how the 
> programming model is changed due to the addition of it? )
>
> Thank you.