I have declared an UIViewController to show more views because my program needs multiple views. OK everything is ok and another pages will load when i need but when i add outlets (in vies) to Files Owner (for example a button). application wont work, and will quit immediately.
I have described my issue complete in this video: http://www.youtube.com/watch?v=vsx-72TP2m8
Thanks and Best regards
Definitely the best described question I have seen so far!
The problem is that you are trying to force a UIViewController
to load a XIB whose file owner is of type SOME
. Although SOME
inherits UIViewController
, the outlet connections (let's say variables) belong to SOME
. So the runtime tries to connect the outlets from the XIB, to the UIViewController
instance. This is why you are getting an NSUnknownKeyException.
The best thing to do is:
SOME homePage = new SOME();
instead of UIViewController homePage = new UIViewController("SOME", null);
.
Remember, it is SOME
's constructor (nibName, bundle) you need, not UIViewController
's.