Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS include UIViewController from another xcode project

Tags:

ios

xcode4

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

like image 760
Dave Avatar asked Feb 10 '26 16:02

Dave


1 Answers

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. e.g. 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.

like image 50
Bill Burgess Avatar answered Feb 12 '26 15:02

Bill Burgess



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!