如何在 XCode 4.3 中创建新的视图控制器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10708936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create new View Controllers in XCode 4.3
提问by user1007895
So I have figured out that in XCode 4.3, to create a new ViewController, I have to do New > Objective-C Class, then subclass UIViewController. But, how come the xib checkbox is greyed out? How do I create a new view controller with an xib?
所以我发现在 XCode 4.3 中,要创建一个新的 ViewController,我必须执行 New > Objective-C Class,然后子类化 UIViewController。但是,为什么 xib 复选框是灰色的?如何使用 xib 创建新的视图控制器?
回答by Mick MacCallum
It looks like you're trying to add an OS X Objective-C class to an iOS project
看起来您正在尝试将 OS X Objective-C 类添加到 iOS 项目
which produces this..
产生这个..
Instead add the new file like this..
而是像这样添加新文件..
which produces this..
产生这个..
回答by Jesse Naugher
I have no idea why the xib box is grayed out (doesn't happen for me), but you can always just go to new file and create a nib from there and set its class to your UIViewController
subclass in interface builder.
我不知道为什么 xib 框变灰(对我来说不会发生),但是您始终可以转到新文件并从那里创建一个笔尖并将其类设置为您UIViewController
在界面构建器中的子类。
回答by alexandresoli
This is a bug, just select the UIViewController again in the Subclass ofcombo and it will be enabled again.
这是一个bug,只需在combo的Subclass中再次选择UIViewController ,它就会再次启用。
Happened to me when i canceled the creation once and opened the dialog again.
当我取消一次创建并再次打开对话框时发生在我身上。