Reputation: 1759
I am creating an app in which I am able to swap the views using the top buttons named "1"and "2"....using them i can swap the views in the box. I am using the view controller. but the problem is that I want to swap my views using the buttons inside the view. I want to swap the view when I press the button inside one view. I have tried all the thing but not working. [box setContentView:v]; [box addSubview:v]; Please help
Upvotes: 1
Views: 441
Reputation: 1296
For button '1' action...
//For opening the second nib on first button click NSWindowController * second=[[NSWindowController alloc] initWithWindowNibName:@"secondNIB"]; [second showWindow:self]; //For closing the first nib, optional //firstWindow is NSWindow [firstWindow orderOut:nil];
For button '2' action...
//For opening the first nib on second button click NSWindowController * first=[[NSWindowController alloc] initWithWindowNibName:@"firstNIB"]; [first showWindow:self]; //For closing the second nib, optional //secondWindow is NSWindow [secondWindow orderOut:nil];
Upvotes: 0