简体   繁体   English

xcode 4.3中如何导入工程或库到ios app

[英]How to import project or library to ios app in xcode 4.3

I have downloaded an iOS project and would like to know how to import this into my app in xcode 4.3.我已经下载了一个 iOS 项目,想知道如何将它导入到我的 xcode 4.3 应用程序中。 Do I have to copy over every single.h and.m file into my project?我是否必须将每个 single.h 和 .m 文件复制到我的项目中? or can I just import it as a library type thing.或者我可以将它导入为库类型的东西吗? And if so, how?如果是这样,怎么办?

The easiest way is just downloading the whole project, and copy the whole folder in your project (drag and drop in your project navigator)最简单的方法就是下载整个项目,然后将整个文件夹复制到项目中(拖放到项目导航器中)

Then, you add the.h in the class you want to use and thats all!然后,在你要使用的class中加上.h就可以了!

This really depends on the library or component in question.这实际上取决于所讨论的库或组件。 Most open source projects provide some sort of documentation or guidelines that guide you through a suggested inclusion scenario.大多数开源项目都提供某种文档或指南,指导您完成建议的包含方案。 Cocoa-Touch-Barcodes is one of the few exceptions that don't give you any hints. Cocoa-Touch-Barcodes 是为数不多的不给您任何提示的例外之一。

In general you have several options for a library like Cocoa-Touch-Barcodes, two of the more convenient ones being:一般来说,对于像 Cocoa-Touch-Barcodes 这样的库,您有多种选择,其中两个更方便的是:

  1. Create a workspace and add the library to it (see this tutorial for details).创建一个工作区并将库添加到其中(有关详细信息,请参阅本教程)。
  2. Nest the project inside of your existing project and set it up as a dependency (see the three20 guide , the "Manually add Three20 to your project" section too see and example - for Cocoa-Touch-Barcodes it's even simpler as you don't have several projects and bundles).将项目嵌套在现有项目中并将其设置为依赖项(请参阅three20 指南,“手动将 Three20 添加到您的项目”部分以及示例 - 对于 Cocoa-Touch-Barcodes,它甚至更简单,因为您不有几个项目和包)。

In theory, the first approach is better and considered the modern way of doing things, but unfortunately there still seem to be some Xcode related quirks here.从理论上讲,第一种方法更好并且被认为是现代的做事方式,但不幸的是这里似乎仍然存在一些与 Xcode 相关的怪癖。 For the time being I would still recommend doing the second approach.目前我仍然建议采用第二种方法。

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

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