简体   繁体   中英

iPhone SDK 3.2 Universal App issue with .xib files

So I am finding this process of universalizing my iPhone app to be a big headache! Am I alone in this? I sure hope not. Anyway, my question is regarding the .xib files for my universal application.

I had my iPhone OS 3.1 running app all ready to make the universal switch. I went up to Project/Upgrade Current Target for iPad/Universal Application and it supposedly made my app have all the necessary iPad settings...

So when I went to test it in 3.2 SDk, the screen was big, meaning the toolbar was sized correctly for the iPad, but the image that was being displayed was for the OS 3.1, meaning it was way small. So I then went to the iPad Source folder, changed the name of my MainViewController.xib file to MainViewController-iPad.xib, and inserted the bigger image I had prepared for the iPad, and it still didn't work correctly.

Then, I went into my MainViewController.m file and changed the nib reference from MainViewController to MainViewController-iPad, and it worked! My only concern is that being that I had to "hard-code" it in, or force it to read from my -iPad file, is that going to present issues for the OS3.1 version? I can't go back and test the 3.1 version now for some reason, the option was removed from the Active SDK menu...

If there is anyone out there that has experienced this, or has insight into what I am doing wrong, your help would be greatly appreciated. Thank you!

Your Info.plist should have a key NSMainNibFile~ipad, which determines which nib will load for iPad. If you were 'manually' loading your nib file, then this would have been fixed to the specific nib file, and you should rewrite to detect iPad/iPhone and load the right nib.

Continuing off of what paull has said... Under the Resources folder group open the 'Info.plist' file using the built in editor/viewer. There will be a line that says 'Main nib file base name'. Click the '+' tab on the right hand side (Key column) and select 'Main nib file base name (iPad)' and set the value to be the name of the associated nib.

只是想知道是否有人在点击目标后做了这个问题,做了一个干净的构建,检查信息等中的所有基本SDK和部署目标设置。因为我已经完成了所有这些(并且完成了几次清除加上退出xcode等。并且我仍然在两个iPad选项上都变得灰暗。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM