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?

徘徊边缘 提交于 2019-12-29 07:52:12

问题


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.

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?


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/9805521/i-didnt-check-the-targeted-for-ipad-option-when-creating-a-view-controller-how

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!