I have two complete projects. One works on iPhone and the other works on iPad. I want to merge these into a Universal app.

So far the only solution I have is to rename app the classes with '_iPhone' and '_iPad' suffixes and change all references to those in the code. Then I could merge the AppDelegates and load the correct controllers at launch.

These are two very big projects so this method is going to be very time consuming. Does anyone have a better solution?

网友答案:

well as far as i know the only solution to do that is to create a new universal project and put your files there .. since there is a lot of share code between iPhone and iPad you can check what the device is used to running your app by check if UI_USER_INTERFACE_IDIOM()is UIUserInterfaceIdiomPad or UIUserInterfaceIdiomPhone .. and for the rename the easy way to do that to highlight the class name and select Refactor>Rename and xCode will take care about rename class name in every where you used it.

网友答案:

Your drafted solution seems to be the only option I know of - curious to see other answers.

One thing though; you could actually keep two separate AppDelegates.

Within your main-implementation, you could check the device and launch either the iPad-AppDelegate or the iPhone-AppDelegate.