简体   繁体   中英

iPhone - How to transform an iPhone only app to universal app?

how can i transform an iPhone only app to an universal application? EDIT : FOUND SOLUTION If you want to have the "Upgrade current target to iPad" option selected, you must have Target Device Family set to iPhone only, not iPad/iPhone. It works for me!

If you want to do it manually, first create a dummy/template Universal app, look at the differences between it and your app, and change your app to eliminate those differences. Among the steps:

Create iPad subdirectories.

Create suitable xibs for the iPad in that subdirectory. Interface Builder has a menu item to convert generic .xibs automatically.

Modify your info.plist (add the NSMainNibFile~ipad key) to use an iPad xib for the iPad main window. Also add appropriate icons, etc. to this plist.

Either create new subclasses for the iPad, or use modify your existing subclasses to check the UI paradigm and select the appropriate UI subelements & sizes in code. You can check in code using something like:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    ...
} else {
    ...  // iPhone stuff, etc.
}

If you created new classes, plug them into the iPad xibs as needed.

Modify all your Target settings to build for iPad and iPhone.

"The first step is to select your target in Xcode, right-click and use the “Upgrade Current Target for iPad…” command. You will presented with a choice:

在此输入图像描述

Select “One Universal application” and Xcode will do (some) of the hard work for us. The Apple guidelines warn against trying to manually migrate your target though to be honest it is hard to really see why. Also note that if your project has more than one target you can only run the upgrade task once. You will need to check all of your targets and adjust the build and Info.plist settings yourself."

http://useyourloaf.com/blog/2010/4/7/converting-to-a-universal-app-part-i.html

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