How to create new View Controllers in XCode 4.3

2020-02-08 12:33发布

问题:

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?

回答1:

It looks like you're trying to add an OS X Objective-C class to an iOS project

which produces this..

Instead add the new file like this..

which produces this..



回答2:

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.



回答3:

This is a bug, just select the UIViewController again in the Subclass of combo and it will be enabled again.

Happened to me when i canceled the creation once and opened the dialog again.



标签: iphone xcode