Hi
I'm trying to do something a bit elaborate but that should be possible, so here is a challenge for all you experts out there (this forum is pack of the lot of you :) ).
Im creating a Questionnaire "component" I want to load on a NavigationContoller my QuestionManagerViewController. This is an "empty" view controller that can load different views depending on the question that needs to be answered.
The way I'm doing this is:
- Create the Question1View object a as UIView subclass, defining some IBOutlets.
- Create (using Interface Builder) the Question1View.xib (HERE IS WHERE MY PROBLEM PROBABLY ARE). I set the both the ViewController and the View to be of class Question1View.
- I link the outlets with the view's component (using IB).
I override the inithWithNib of my QuestionManagerViewController to look like this:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:@"Question1View" bundle:nibBundleOrNil]) { // Custom initialization } return self; }
When I run the code Im getting this error:
2009-05-14 15:05:37.152 iMobiDines[17148:20b] * Terminating app due to uncaught exception '
NSInternalInconsistencyException
', reason: '-[UIViewController _loadViewFromNibNamed:bundle:]
loaded the "Question1View" nib but the view outlet was not set.'
Im sure there is a way to load the view using the nib file, without needing to create a viewController class.
Any ideas?
Thanks!
Gonso