开发者

Update Target from iPhone- to Universal-App

I started today to upgrade my iPhone-App to an Universal-App. So I'm using Xcode 4 and I changed the setting of my target to Universal. Xcode asked me if I want to convert MainWindow to a iPad-Version, I answered with yes and the problems started.


What happened?

If I built my application, the simulator rezised my iPhone-Nib to a awful iPad-Version. I didn't want this and searched for a function which converts my iPhone-Nib into a iPad-Nib. But I didn't find any function like this and searched for it online. Someone wrote that this function got removed in Xcode 4 and the best solution would be to copy the iPhone-Nib in Finder into the iPad-Folder of my project. I did this and added the new "iPad-Nib" into Xcode to adjust it a bit. Then I built my project again and I saw the same rezised, awful iPhone-Nib like before, so I cleaned my Target and built it again. Now the Simulator showed the right "iPad-Nib" to me but some objects were still not on its right place but some were...

开发者_JAVA百科

I started to adjust my Nib for the Simulator, now my App looks fine in the Simulator and like crap in Xcode. Also my app sometimes loads the awful, resized iPhone-Nib.

What did I wrong? And is there another possibility to create the "iPad-Nib"?


When you answered YES to convert MainWindow to an iPad Version, Xcode took your iPhone nib, copied it, and adjusted the Window and Views to have the proper iPad size. That's it. It's now up to you to start making adjustments to your views.

The link posted by ferbass is a great starting point to start learning about changing your app to be universal. There is a whole xcode project posted that you can download and look through.

The key point I took from it was using the UI_USER_INTERFACE_IDIOM() to determine which platform the app is currently running on. Using this in your view controllers will allow you to adjust the view accordingly.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    // Do iPad related stuff
}
else {
    // Do iPhone related stuff
}


see this tutorial http://www.raywenderlich.com/1111/how-to-port-an-iphone-application-to-the-ipad

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜