Jeremy Smith
Jeremy Smith

Reputation: 15069

Why isn't my subview loading?

I have a project with 3 .xib files, MainMenu, FileUploadView, FileBrowseView.

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

Answers (1)

AliSoftware
AliSoftware

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

Related Questions