开发者

Differences Between Cocoa and iPhone development

I'm currently reading Aaron Hillegass' book "Cocoa Programming for Mac OS X" as it is highly recommended throughout the community. I'm wondering if there's an extreme difference between "Cocoa Programming" and iPhone development. I'm more interested 开发者_StackOverflow社区in iPhone development, but I figured iPhone development would be easier to pick up if I was comfortable with Cocoa before moving on.


iPhone programming is a form of Cocoa (technically "Cocoa Touch"). It shares almost all the same programming idioms, and there's a huge overlap in the frameworks.

Hillegass' book is a great starting point for either. After about chapter 7 in Hillegass, you'll start getting into more "Mac" topics like document window management etc. None of this is bad to understand, but that's where it begins to differ in the details, and you'll find that it won't translate quite so directly.

The patterns he teaches you to think in will be useful in all cases. But the actual classes and objects you use for the Mac stuff don't all have equivalences in the iPhone world. On iOS, the view management (UIView) is quite different from Mac's NSView stuff. It's actually simpler and easier to understand on the iPhone, I found.

Hillegass has a new iPhone-specific book out. I haven't browsed through it yet.


The biggest difference is that there is no garbage collection in iPhone programming. You will be making a lot of retain and release calls that are not needed in MacOS Cocoa.

A second difference is that some of Apple's classes are different. In general, some of the less-frequently-used methods are gone from the iPhone versions of classes.

Lastly, you have all the UIKit classes such as UITableView, UITouch, and so on, which do not have counterparts in MacOS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜