4

I made a mistake when I created one of my UIViewController objects. When I created the files, I forgot to select the Target for iPad option.

'Targeted for iPad' not selected

I never considered this to be much of an issue, because I always change my initial view within the generated Nib file to not display a statusbar, and to be freeform in sizing.

However, I've recently ran into a problem. The UIViewController that I created that wasn't Targeted for iPad has a toolbar on it. This means that the default style is a bluish color. The problem is that all of my other views were created for the iPad and the default iPad style is a greyish tone, instead of the bluish tint color that is associated with iPhone/iPod devices.

I need my application to remain consistent and I'd rather not start from scratch, re-making my Nib file, and re-wiring it to my ViewController.h file.

How can I fix my Nib and View Controller so that it behaves as if it is Targeted for iPad, even though I've mistakenly not specified it as such?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
RLH
  • 15,230
  • 22
  • 98
  • 182
  • 1
    You could create a new *Targeted for iPad* nib and cut-and-paste the contents from the old one. I think you'll still need to rewire it, though. – Brian Mar 21 '12 at 13:56

2 Answers2

4

Try this at your own risk:

First, back-up your original Xib file. Next, modify the second line from:

<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">

to

<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00">

Next, open the source code of the xib, and in every ocurrence of the element:

<string key="IBDocument.TargetRuntimeIdentifier">

Replace the value IBCocoaTouchFramework with IBIPadFramework.

Good luck!

RLH
  • 15,230
  • 22
  • 98
  • 182
LuisEspinoza
  • 8,508
  • 6
  • 35
  • 57
  • Also, maybe you should have to modified the line 2 with – LuisEspinoza Mar 21 '12 at 13:54
  • Luis, I'm not sure if you yet have the privileges to update your answer, so I integrated your last comment into youe answer. This is what I needed. Thank you. – RLH Mar 21 '12 at 14:10
0

Change it in Build Settings -> Targeted device family OR under Devices in Summary tab.

You'll find the above in your project's Targets section.

EDIT: Sorry for the misunderstanding. THIS SO post seems to address your issue.

Community
  • 1
  • 1
Bourne
  • 10,094
  • 5
  • 24
  • 51
  • No, this answer is for the project. The project is set to be target strictly for the iPad. However, one single UIViewController+Nib was not created with that option checked. How can I fix the Nib? – RLH Mar 21 '12 at 13:30
  • Ah, thanks for the update. I slightly modified my title. Your linked question is answered, however, it's not the one that's marked the answer. My question is in regards ti XCode 4.2+. I think this is going to have to be done through modifying the XML in the Xib. :( – RLH Mar 21 '12 at 13:49