简体   繁体   中英

iOS include UIViewController from another xcode project

I've spent some time building an iOS project, however I'd like to reuse one of the UITableViewControllers in another project.

This UITableViewControllers is quite complex (being a custom UITableViewController that inherits from another ViewController and contains multiple classes via #imports, so its not simply a case of copying over the .h, .m and .xib file)

Whats the best way to do this in xcode4? The options I've considered are building a library (.a), a framework (.framework) or importing the new xcodeproject into the original one.

Thanks

I think building your custom view controller into a static library would be the easiest method to include it in your new project. But will require a bit of work in the old project to make sure you get everything included and built correctly. With Xcode 4, libraries are no longer built into 1 static fat library, you end up with 1 library just for the specific build. eg iphonesimulator-debug. You will need to either include all the different versions of these libraries or add a build script that will build all of them in create just 1 static library (which will make your life much easier I can promise you that).

This post on SO, Build Fat Static Library , saved me hours of work with static libraries. Hopefully it will help you too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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