views:

345

answers:

1

Hey Guys,

I'm trying to load a view controller from a nib in Interface Builder. My basic setup is this:

MainWindow.xib contains: All the usual stuff, the app delegate instance, the Window etc.

A UINavigationController which has a UIViewController as it's Root View Controller. The nib name of the UIViewController is set to the name of the xib that contains my view controller.

The view controller in my separate xib has the file's owner's type set to the controller class for that view.

Whenever the view loads (ie, when the app starts), an exception is thrown stating that my controller class isn't key-value-coding compliant for the key [insert random variable name here]. Most of the time the key is a name I've given to a button or something else I've set as an IBOutlet.

Why is this happening? What am I missing? I've tried creating properties for each of these variables to generate KVC compliant accessors, but it still throws the exception.

Any help would be awesome, thanks!

+1  A: 

The app is trying to treat your UIViewController like a UINavigationController, which it's not.

Subclass the Root View Controller as UINavigationController, instead of UIViewController:

@interface rootViewController : UINavigationController {
Glen