1:原文摘自:http://three20.info/article/2010-10-06-Adding-Three20-To-Your-Project
Introduction
Before you begin using Three20 in your project, you should decide what directory layout works best for you.
Recommended: Shared Layout
In this layout, Three20 is shared between multiple projects. If you need to make project-specific modifications to Three20, use git branches.
If you are unfamiliar with git, it's highly recommended that you learn the basics in order to take advantage of this directory layout.
Directories
Example workflow
three20 > git checkout app1 |
three20 > open ../projects/app1/app1.xcodeproj |
three20 > git checkout app2 |
three20 > open ../projects/app2/app2.xcodeproj |
three20 > git checkout -b app3 master |
three20 > git rebase origin/master master |
three20 > git rebase master app1 |
Submodule Layout
In this layout, Three20 lives directly within each project's folder as a git submodule. This layout can be useful if you don't plan to make modifications to Three20.
Directories
Example workflow
projects/app1 > git submodule add git://github.com/facebook/three20.git three20 |
projects/app1 > git submodule init |
projects/app1 > git add three20 |
projects/app1 > git commit -m "Add Three20 submodule" |
Add Three20 to your project
There are two primary means of adding Three20 to your project. The first method is recommended and will automatically add Three20's libraries to your project and set up the necessary project settings. Sometimes this first method will fail, so you can fall back on the second method to add Three20 to your project by hand.
Automatically add Three20 to your project
Three20 includes a python script that adds Three20 to Xcode iOS projects. Running it without any arguments will print the script's help guide.
> python three20/src/scripts/ttmodule.py |
In order to add Three20 to your project, it's recommended that you do the following:
> python three20/src/scripts/ttmodule.py -p path/to/myProject.xcodeproj Three20 |
This will add the Three20 module and all of its dependencies to your project.
If your target's name does not match your project's name, you will need to set it explicitly.
> python three20/src/scripts/ttmodule.py -p path/to/myProject.xcodeproj:myTargetName Three20 |
If the script displays errors, it's possible that your project is located in a folder with non-standard characters, such as spaces, that aren't being escaped properly. If this happens, it might be easiest to move your project to a path that doesn't contain spaces. If this is not an option, you can follow the manual directions below.
This screencast will walk you through the above process with the "Shared Layout" project layout.