Application Design - Differences between iPhone and Cocoa applications?
In iPhone development for every page you see there are 2 files, a nib file, and a view Controller (books.nib, booksViewController.m), but in a Cocoa application apple suggests to have 3 files (books.nil, books.m, booksViewController). What is the point of having 2 class files? is 开发者_运维知识库it a bad idea to connect the attributes to the outlets in the interface, in the same file that the logic goes?
so keep it exactly like iphone a nib file, and ciew controller?
I think you've misunderstood. If you were creating a Books app for the iPhone, wouldn't you have a Book class for your data model? That's the "third" file you're seeing. You have one file for the controller class and one for the model class. It's a basic MVC architecture (with the nib being the "V").
But there are differences in how applications are structured on the two platforms. It basically comes down the fact that iPhone apps are always fullscreen "kiosk"-style systems, while Cocoa apps are window- and document-based. In a Cocoa app, a view is just an area of a window that you can paint in and respond to mouse clicks, and view controllers are support objects for laying them out. On the iPhone, your entire app interface is essentially a stack of view controllers, each of which manages a whole screen.
精彩评论