[Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?
-
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.ac
tion,
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. -
The iPhone SDK, including all APIs, is still under NDA. It can't be
discussed here, nor can it be discussed in any other public forum.
b.bum -
<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.ac
tion
> ,
> 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.
-
I'm sorry. I thought that the announcement of the final Xcode 3.1 also
covered the iPhone SDK issue automatically.
Thanks for reminding me of that.
Waqar Malik wrote:
> <http://lists.apple.com/archives/Xcode-users/2008/Jul/msg00276.html>
>
> Still under NDA.
-
On Jul 14, 2008, at 4:15 PM, JongAm Park wrote:
...
> (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? )
The NSViewController documentation does a good job. The Overview
section outlines three things that the NSViewController will handle
for you.
I have not used the NSViewController in my project. But I think it is
mostly useful when you want to load a (custom) view from a NIB/XIB
file and hook it up to a bindings enabled data source.
For me the class reference is a bit dry. I would love to read more in
the style of WHY you would want to use a certain class. A more
pragmatic 'recipe' style documentation.
S. -
On Jul 14, 2008, at 11:50 PM, Stefan Arentz wrote:
>
> On Jul 14, 2008, at 4:15 PM, JongAm Park wrote:
>
> ...
>
>> (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? )
>
> The NSViewController documentation does a good job. The Overview
> section outlines three things that the NSViewController will handle
> for you.
>
> I have not used the NSViewController in my project. But I think it
> is mostly useful when you want to load a (custom) view from a NIB/
> XIB file and hook it up to a bindings enabled data source.
>
> For me the class reference is a bit dry. I would love to read more
> in the style of WHY you would want to use a certain class. A more
> pragmatic 'recipe' style documentation.
Just found this, should be interesting for other people ...
http://katidev.com/blog/2008/04/09/nsviewcontroller-the-new-c-in-mvc-pt-1-o
f-3/
http://katidev.com/blog/2008/04/17/nsviewcontroller-the-new-c-in-mvc-pt-2-o
f-3/
http://katidev.com/blog/2008/05/26/nsviewcontroller-the-new-c-in-mvc-pt-3-o
f-3/
S.



