Issue with xib files for iPad universal
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
You can create iPad specific xibs very simple from existing standard iPhone xibs:
- open iPhone xib in Interface Builder
- in
Menu
of Interface Builder selectFile
andCreate iPad version
(orCreate 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 isMyViewController.xib
your iPad xib should beMyViewController~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).
精彩评论