简体   繁体   English

可可与可可之间的区别

[英]The Difference between Cocoa and Cocoa Touch

I am a beginner to iPhone development, I know the only very basic concepts of it. 我是iPhone开发的初学者,我知道它唯一非常基本的概念。 While I'm reading, I got a small question, what is the main difference between cocoa and cocoa touch? 在我读书的时候,我遇到了一个小问题,可可和可可触摸之间的主要区别是什么?

Can anyone one please help? 任何人都可以帮忙吗?

Cocoa is for Mac OS X, Cocoa Touch for iOS. Cocoa适用于Mac OS X,适用于iOS的Cocoa Touch。 In Cocoa Touch, the UI classes all start with the prefix "UI" as in "UIButton", "UIView", etc. pp. while in Cocoa, the have the "NS" prefix as in "NSButton", "NSButton" (the NS stands for NextStep which is a predecessor to Mac OS X). 在Cocoa Touch中,UI类都以前缀“UI”开头,如“UIButton”,“UIView”等。在Cocoa中,“NSButton”中有“NS”前缀,“NSButton”( NS代表NextStep,它是Mac OS X的前身。

Cocoa has more features than Cocoa Touch. Cocoa具有比Cocoa Touch更多的功能。 But overall their APIs are very similar (they are not the same, but you will likely find it easy to find your way in one API if you already know the other). 但总的来说,他们的API非常相似(它们不一样,但如果您已经了解另一个API,您可能会发现在一个API中找到自己的方式很容易)。

As told very well by DarkDust would like to add few more points. 正如DarkDust所说的那样,我想补充几点。

The main difference between Cocoa and Cocoa touch is that the UI classes and APIs aren't the same as Mac OS X, so instead of NSTextField , you have UITextField . Cocoa和Cocoa触摸的主要区别在于UI类API与Mac OS X不同,因此您使用UITextField代替NSTextField

Cocoa is the application framework for Mac OS X . Cocoa是Mac OS X的应用程序框架。

Cocoa Touch is the application framework for iPhone and iPod Touch - very similar to Cocoa. Cocoa Touch是iPhoneiPod Touch的应用程序框架 - 与Cocoa非常相似。

Cocoa is commonly referred to as the combination of the Foundation and AppKit frameworks. Cocoa通常被称为Foundation和AppKit框架的组合。
Cocoa Touch is the combination of the Foundation and UIKit frameworks Cocoa Touch是Foundation和UIKit框架的组合

There are also some differences between the Foundation frameworks in Cocoa and Cocoa Touch, most commonly missing classes, eg, Cocoa has NSHost and Cocoa Touch does not. Cocoa和Cocoa Touch中的Foundation框架之间也存在一些差异,最常见的是缺少类,例如,Cocoa有NSHost而Cocoa Touch没有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM