The problem with xib files for iPad is universal

I have an iPhone app, and I'm trying to change it to a universal app in Xcode 3.2. I just want to create new xib files for the iPad.

So, I just expand Targets, click on "Project \ Upgrade Current Target for iPad" and select "One Universal Application."

I have many xib files in my application and I want to create new iPad xib files for the same controller, for example, I want to target mainpage-iPad.xib to mainpage.m.

In IB for mainpage-iPad.xib, I set the class to "mainpage", which seems to be insufficient, whenever I run the ipad simulator, I always get the view changed as iphone.

Can you point out what I'm doing wrong and suggest the right way to target the xib file to my controllers.

thanks

+7
source share
1 answer

You can create iPad-specific xib files very simply from the existing standard iPhone xib-systems:

  • open iPhone xib in the Builder interface
  • in the menu of the interface builder, select File and Create iPad version (or Create iPad version using Autosizing Masks )
  • save the new iPad xib and add it to your project; the name of the iPad xib should be the same as the iPhone xib with the suffix ~ipad - for example. if your iPhone xib is MyViewController.xib , your iPad xib should be MyViewController~ipad.xib (use ~ipad instead of -iPad )

After that, your iPad xib will automatically be used on the iPad. Of course, you will also need to upgrade your project to a universal application (as you said).

+17
source

All Articles