Reputation: 15069
I have a project with 3 .xib files, MainMenu, FileUploadView, FileBrowseView.
MainMenu has a NSPanel, it's owner is AppDelegate, and AppDelegate has an outlet to NSPanel called FilePanel. The NSView below the NSPanel is called filePanelView and also has an outlet in AppDelegate.
FileUploadView is an NSView, it's owner is FileUploadViewController. It has an outlet called uploadView in the controller.
So in App delegate I have the following code:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
fileBrowseViewController = [[FileBrowseViewController alloc]
initWithNibName:@"FileBrowseView" bundle:nil];
}
- (IBAction)importHandsClicked:(id)sender {
[NSApp activateIgnoringOtherApps:YES];
[filePanel setIsVisible:YES];
[filePanelView addSubview:[fileBrowseViewController browseView]];
}
The action does make filePanel visible, but it doesn't add the browseView to it. Am I doing something wrong?
Upvotes: 0
Views: 91
Reputation: 32681
Check that [fileBrowseViewController browserView]
is not nil
.
This is highly probably, especially if you forgot or failed to link your browseView
IBOutlet to the actual UIView that represents your FileBrowseView
instance in InterfaceBuilder.
[EDIT] For more info about connecting outlets, see Apple's InterfaceBuilder Help here (including tutorial video).
Upvotes: 2