views:

2082

answers:

3

Hello! 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!

+1  A: 

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.

Paul Lynch
A: 

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.

Michael Turner
That should have been set by the Upgrade Target - but worth checking.
Paul Lynch
I didn't know of the 'Upgrade Target' menu selection... and looking at it now, some of my iphone projects (that I haven't touched recently) that is grayed out for some reason... a ha, need to select the target itself. Ok. Failing knowing of that (thank you for pointing it out), its not too bad modifying the project info and plist. I had previously created a universal app and then looked through what all the differences where between the files and projects for the two were.
Michael Turner
A: 

Just wondering if anyone has this problem even AFTER clicking on the target, doing a clean build, checking all base SDK and deployment target settings in info etc. Because I've done all of this (and a couple total cleans plus exit xcode etc.) and I'm still getting greyed out on both iPad options.

Catherine