iphone中加入three20支持步骤

1. 下载
Three20 is compiled as a static library and the easiest way to add it to your project is to use Xcode's "dependent project" facilities. Here's how:

    * Clone the Three20 git repository:
      git clone git://github.com/facebook/three20.git

2. 把three20工程加入到你工程的根目录下
Locate the "Three20.xcodeproj" file under "three20/src/Three20". Drag Three20.xcodeproj and drop it onto the root of your Xcode project's "Groups and Files" sidebar. A dialog will appear -- make sure "Copy items" is unchecked and "Reference Type" is "Relative to Project" before clicking "Add". 
<ignore_js_op>1.jpg

3. 双击three20工程,把它的所有dependencies也加入到你的工程里面
Open the Three20 Xcode Project that you just added to your app and expand the "Dependencies" group. Select all of the projects listed there and drag them to your app as well. You should now have the following list of Three20 projects added to your app:

    * Three20Core
    * Three20Network
    * Three20Style
    * Three20UICommon
    * Three20UINavigator
    * Three20UI
    * Three20
<ignore_js_op>1.jpg

4. 选中需要link的库
Now you need to link the Three20 static libraries to your project. Select all of the project items that you just added to the sidebar. Under the "Details" table, you will see a number of items, such as libThree20.a and libThree20Core.a. Check the checkbox on the far right for each of the lib files (not the UnitTests). This will link each part of the Three20 framework to your app.
<ignore_js_op>1.jpg

5. 在你的项目target中加入dependency
Now you need to add Three20 as a dependency of your project, so Xcode compiles it whenever you compile your project. Expand the "Targets" section of the sidebar and double-click your application's target. Under the "General" tab you will see a "Direct Dependencies" section. Click the "+" button, select "Three20" and each of the other libs, and click "Add Target". You do not need to add the UnitTests target for each lib.
<ignore_js_op>1.jpg

6. 把three20.bundle加入到你的工程中
Now you need to add the bundle of images and strings to your app. Locate "Three20.bundle" under "Three20/src" and drag and drop it into your project. A dialog will appear -- make sure "Create Folder References" is selected, "Copy items" is unchecked, and "Reference Type" is "Relative to Project" before clicking "Add".
<ignore_js_op>1.jpg

7. 加入其他framework
Now you need to add the Core Animation framework to your project. Right click on the "Frameworks" group in your project (or equivalent) and select Add > Existing Frameworks. Then locate QuartzCore.framework and add it to the project.

8. 设置搜索header路径(注意这里添加相对于文件系统的路径,比如我的测试工程Three20Demo在/Users/wuvincent/Downloads下,而three20下载到了/Users/wuvincent下的,这时候加的header搜索路径为"http://www.cnblogs.com/three20/Build/Products/three20")
# Finally, we need to tell your project where to find the Three20 headers. Open your "Project Settings" and go to the "Build" tab. Be sure to select the appropriate active configuration (eg, Release vs. Debug -- eventually you'll need to change both). Look for "Header Search Paths" and double-click it. Add the relative path from your project's directory to the "three20/Build/Products/three20" directory. If your project and the Three20 source are in the same parent, you would enter "../three20/Build/Products/three20".
# While you are in Project Settings, go to "Other Linker Flags" under the "Linker" section, and add "-ObjC" and "-all_load" to the list of flags.
# You're ready to go. Just #import "Three20/Three20.h" anywhere you want to use Three20 classes in your project.

posted on 2012-09-06 19:46  barani  阅读(227)  评论(0编辑  收藏  举报

导航