I have the following probl开发者_运维百科em. I have an iPhone app and want to upgrade to universal When I do this, I get the expected MainWindow-iPad.xib. But the size of the window is hardcoded to 320x480. Also, there is no view in the window. I red, this should be automatically iPad-sized, so I am assuming I am doing something wrong. What exactly am I missing ? thanks in advance
Yes, the dimensions of a UIWindow
object are hard-coded to the size of the iPhone screen. This confused me, too, until I realized there was an option to resize it: select the UIWindow
object in the .xib in Interface Builder... in the Attributes pane, make sure the "Full Screen at Launch" checkbox is checked.
As St3fan says you'll probably want to have a specific main window .xib for your iPad build.
See my answer at:
UITabBar unresponsive on iPad
I got this. I fixed it by deleting the automatically created ipad xib, then opening the original xib in interface builder and choosing convert to iPad from the menu. Then ni saved it with the -iPad name and added it to the corredt target.
You will probably also need to create a MainWindow-iphone.xib
and MainWindow-ipad.xib
.
I had a similar issue with a GLES application - using EAGLView, in a manner similar to all of the samples, but wanting to support iphone3,iphone4,and ipad.
in my context creation from [EAGLView initWithCoder], I was forcing the eaglLayer's rect to match the main screen, which worked for iphone and iphone4 (i.e. gave me a 320x480 or 640x960 gl surface), but for ipad, this gave me a 768x1024 surface which was cropped on present to 640x960. As it turns out, The "Full Screen at Launch" option seems to be applied AFTER the view's (EAGLView, in my case) initWithCoder.
My solution was to do nothing in the [EAGLView initWithCoder], and only actually initialize my view after the AppDelegate's didFinishLaunchingWithOptions gets called, in the layoutSubviews call.
HTH, forks
精彩评论