如何在Apple iOS应用程序中使用Cocoa框架 [英] How to use Cocoa framework in Apple iOS applicaiton
问题描述
我正在开发一个iPhone应用程序。在我的iPhone应用程序中,我使用基于视图的
应用程序模板。现在我想使用 Cocoa
框架在我的iOS应用程序中使用 NSOpenPanelController
。如何使用Cocoa框架,我在iOS中在哪里使用它?
I am developing an iPhone application. In my iPhone application, I am using the view-based
application template. Now I want to use the Cocoa
framework for using NSOpenPanelController
in my iOS application. How do I use the Cocoa framework, and where do I use it in iOS? Can somebody please explain this to me in detail?
当我在iOS中开始一个新项目时,它会默认添加框架 UIKit > code>和
coreGraphics
。但是当我开始一个新的 Cocoa
应用程序时,默认的框架是 Foundation
, Cocoa
和 Appkit
。
When I start a new project in iOS, it will by default add the frameworks UIKit
and coreGraphics
. But when I started a new Cocoa
application, the default frameworks available are Foundation
, Cocoa
and Appkit
.
我拖动了 Cocoa
框架从 Cocoa
应用程序到我的ios应用程序。这一步是成功的,但是当我开始构建和运行时,它再次要求 AppKit
框架。我也以与 Cocoa
相同的方式拖动那个。然后它要求 foundation
框架。在iOS和Cocoa应用程序的应用程序中, foundation
框架是不同的。如何做到这一点?请帮助。
I dragged the Cocoa
framework from the Cocoa
application to my ios application. That step is successful, but when I started build and run, then it again asked for AppKit
framework. I dragged that one too in the same manner as Cocoa
. Then it asked for foundation
framework. In both the applications for iOS and Cocoa applications, foundation
framework is different. How to do this? Please help.
推荐答案
Cocoa仅适用于Mac OS X(桌面)应用程序。 UIKit仅适用于iOS应用程序。你不能混合和匹配这两个,因为没有系统有两个。 (您可能可以在模拟器中使用这两个应用程序,但它们无法为实际设备构建。)
Cocoa is only available to Mac OS X (desktop) applications. UIKit is only available to iOS applications. You cannot mix and match the two, as there is no system that has both. (You may be able to get some applications to use both in the Simulator, but they will fail to build for the actual device.)
iOS不公开文件系统给用户,所以没有等效的NSOpenPanel可用。你将需要选择一种不同的方法,无论你正在做什么。
iOS does not expose the file system to the user, so there is no equivalent to NSOpenPanel available. You will need to choose a different approach to whatever it is you're doing.
这篇关于如何在Apple iOS应用程序中使用Cocoa框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!