Three20的安装过程
一、 使用 Three20 建立新的工程
1、 下载 Three20 的源码
2、 打开终端, 到 templates/ 目录,然后简单输入如下命令 :
bash InstallTemplates3.2.5.Command
命令执行过后, Three20 的模板就被加入到 Xcode 中了。
3、 新建工程时,可以在“ New Project ”对话框中看到 Three20 的模板。选择相应的模板就可以新建 Three20 的工程。需要注意的是,新建的工程必须和 Three20 的库在同一个目录下。
4、 打开 Three20 的工程文件,将 libThree20.a 的关联去掉,不然会出现编译错误。
二、 在已有工程中添加 Three20 库。
1、 打开要加入Three20 的工程,然后进入目录 /three20/src/Three20/ ,其中有一下Three20.xcodeproj 工程文件,拖动这个文件到打开工程的Framework 文件下,弹出如下对话框,按照图示做出选择:
2、 Three20 中使用了QuartzCore ,所以要在工程中添加QuartzCore 。
在弹出的对话框中选择QuartzCore
:
3、 然后对Three20 的编译进行设置,首先点击刚才加入到Framework 组中的Three20 ,会在右边的窗口中看到如下文件,在右边的方框中,勾选libThree20.a 。如图:
接下来,在Targets 组下选择所编译的程序,调出Info 窗口。选择General 选项卡。然后加入Direct Dependencies ,如图所示:
4、 设置Link 和Head Search Path
打开工程的Info 面板。找到Link 中的Other Linker Flags 选项,加入-ObjC 和-all_load ,如图所示:
然后是设置Head Search Path ,找到Search Path 中的Head Search Paths ,将其值设为:../three20/Build/Products/three20 。其中../ 指的是Three20 所在的目录,例如,在我的机器中,Three20 放在文稿中。那要设置的路径植为/Users/wangwei/Document/three20/Build/Products/three20 。这样设置基本完成。
如果编译时出现如下错误: File /Users/wangwei/Documents/three20/src/Three20/http://www.cnblogs.com/Build/Products/Debug-iphonesimulator/libThree20.a depends on itself. This target might include its own product.
则打开 Three20.xcodeproj 。点击工程名 Three20 ,在右边的列表中取消对 libThree20.a 的勾选。