Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with xib files for iPad universal

Tags:

ios

iphone

xib

ipad

I have a running iPhone app and I am trying to change it into an universal app in Xcode 3.2. I only want to create new xib files for iPad.

So I simply expand Targets click “Project\Upgrade Current Target for iPad” and choose “One universal application”.

On my app I have a lot of xib files and I want to creat new iPad xib files for the same controller, for example I want to target mainpage-iPad.xib to the controller mainpage.m

In IB for the mainpage-iPad.xib I set the class to "mainpage", that seems to be not enough, whenever I run ipad simulator, I always get the view resized as iphone.

Can you point out what I am doing wrong and suggest the proper way to target the xib file to my controllers.

thanks

like image 304
Ben Avatar asked Jun 03 '11 15:06

Ben


1 Answers

You can create iPad specific xibs very simple from existing standard iPhone xibs:

  • open iPhone xib in Interface Builder
  • in Menu of 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 iPad xib should be the same as iPhone xib with ~ipad suffix - e.g. if your iPhone xib is MyViewController.xib your iPad xib should be MyViewController~ipad.xib (use ~ipad instead of -iPad)

After that your iPad xibs will be automatically used on iPad. Of course you will also need to upgrade your project to a Universal Application (just like you said).

like image 189
Piotr Avatar answered Oct 17 '22 02:10

Piotr