I'm loading two different views with this IBActions
- (IBAction)showFirstView:(id)sender{
theDetailViewController = [DetailViewController new];
[theDetailViewController initWithNibName:@"DetailView" bundle:nil];
NSView *splitRightView = [[theSplitView subviews] objectAtIndex:1];
NSView *aDetailView = [theDetailViewController view];
[aDetailView setFrame:[splitRightView bounds]];
[aDetailView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[splitRightView addSubview:aDetailView];
NSLog(@"%@",(NSString *)splitRightView);
}
- (IBAction)showSecondView:(id)sender{
theNewViewController = [NewViewController new];
[theNewViewController initWithNibName:@"NewView" bundle:nil];
NSView *splitRightView = [[theSplitView subviews] objectAtIndex:1];
NSView *aDetailView = [theNewViewController view];
[aDetailView setFrame:[splitRightView bounds]];
[aDetailView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[splitRightView addSubview:aDetailView];
NSLog(@"%@",(NSString *)splitRightView);
}
but with this code I'm just getting the subviews in stack one in front of each other how do i remove the subview from splitRightView before adding the new subview?
thanks.