I need to use a custom view (NSView *mainContent) and swap the view with a different nib based on the user selection from a NSPopUpButton. The IBAction method for the popup button looks like this:
- (IBAction)menuSelected:(NSPopUpButton *)sender {
NSInteger index = [sender indexOfSelectedItem];
NSLog(@"Selected button index is %ld", index);
[dynamicTitle.cell setTitle:[self returnSectionTitle:index]];
NSLog(@"%@", dynamicTitle.stringValue);
switch (index) {
case 0:
Sect1 = [[Sect1_View alloc] initWithNibName:@"Sect1_View" bundle:nil];
maincontent = Sect1.view;
[maincontent release];
break;
case 1:
Sect2 = [[Sect2_View alloc] initWithNibName:@"Sect2_View" bundle:nil];
break;
case 2:
Sect3a = [[Sect3a_View alloc] initWithNibName:@"Sect3a_View" bundle:nil];
break;
case 3:
Sect3b = [[Sect3b_View alloc] initWithNibName:@"Sect3b_View" bundle:nil];
break;
case 4:
Sect3c = [[Sect3c_View alloc] initWithNibName:@"Sect3c_View" bundle:nil];
break;
case 5:
Sect4 = [[Sect4_View alloc] initWithNibName:@"Sect4_View" bundle:nil];
break;
default:
break;
}
}
This doesn't seem to retrieve the new nib, any suggestions on how to accomplish this?
Thanks.