可可与可可触 - 有什么区别? [英] Cocoa versus Cocoa Touch- What is the difference?

查看:121
本文介绍了可可与可可触 - 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Objective-C学习iOS开发,我已经找到了很多代码示例。



其中有些说,他们只是Mac OS X(而不是iOS)。



有人可以向我解释Cocoa和Cocoa Touch之间的区别是什么(在库级别),所以我知道什么

解决方案

p> Cocoa通常被称为Foundation和AppKit框架的组合,而Cocoa Touch是Foundation和UIKit框架的组合。



Cocoa和Cocoa Touch sit在其他框架集合的顶部创建API堆栈。其他层是Media,Core Services和Core OS。



Cocoa和Cocoa touch的主要区别在于UI类和API与Mac OS不同X,所以,而不是NSTextField,你有UITextField。许多类共享相同的功能,可以很容易地通过简单地更改类名称来移植,虽然大多数将需要一些更多的更改,但通常没有太重。



Cocoa和Cocoa Touch中的Foundation框架之间也有一些区别,最常见的是缺少类,例如Cocoa有NSHost和Cocoa Touch没有。



知道更多的两者之间的细微差别,并很快将能够本能地知道什么将工作在一个很少/没有修改的iPhone,什么将需要一些工作之间的端口,但这不是那么困难。


I am learning iOS development in Objective-C, and I have found a lot of code examples.

Some of them, though, say that they are only for Mac OS X (not iOS).

Can someone please explain to me what is the difference between Cocoa and Cocoa Touch (at a library level), so that I know what code will work and what will not work?

Thank you.

解决方案

Cocoa is commonly referred to as the combination of the Foundation and AppKit frameworks, while Cocoa Touch is the combination of the Foundation and UIKit frameworks.

Cocoa and Cocoa Touch sit on top of other collections of frameworks to create the API stacks. The other layers are Media, Core Services and Core OS.

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. Many of the classes share the same functionality and can be ported quite easily by simply changing the class name, though most will require some more changes, but usually nothing too heavy.

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 doesn't.

You will come to know more of the nuances between the two and will soon be able to instinctively know what will work on an iPhone with little/no modification and what will require some work to port between, but it's not that difficult.

这篇关于可可与可可触 - 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆