Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
806 views
in Technique[技术] by (71.8m points)

iphone - I didn't check the Targeted for iPad option when creating a View Controller. How can I fix my UIView to be targeted for iPad devices using XCode 4.2?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...