This is for a Mac App and not for iPhone. What I want to do is take my current xib “Welcome Screen” and when it opens, load in another xib “WelcomeScreenText1” in a custom view called myTargetView. When it runs the error message is “[NSViewController loadView] loaded the “WelcomeScreenText1″ xib but no view was set.” Please help!
#import "WelcomeMainViewController.h"
#import "WelcomeText1ViewController.h"
#import "WelcomeText2ViewController.h"
@implementation WelcomeMainViewController
NSString *const text1Title = @"WelcomeScreenText1";
- (void)awakeFromNib
{
WelcomeText1ViewController* imageViewController =
[[WelcomeText1ViewController alloc] initWithNibName:text1Title bundle:nil];
if (imageViewController != nil)
{
myCurrentViewController = imageViewController;
}
// embed the current view to our host view
[myTargetView addSubview: [myCurrentViewController view]];
// make sure we automatically resize the controller's view to the current window size
[[myCurrentViewController view] setFrame: [myTargetView bounds]];
}
- (NSViewController*)viewController
{
return myCurrentViewController;
}
@end
The message means that the nib didn’t connect anything to the
viewoutlet of the view controller.In your nib, make sure the custom class of File’s Owner is set to
WelcomeMainViewController. Then make sure that theviewoutlet of File’s Owner is connected to the top-level view of the nib.