I'm very new for mac application. Previously I've worked only for iPhone application and now I've started to learn mac application. I've created a simple application, for every application we have default toolbar at the top of the screen. So on clicking new I want to stay on the current window and switch to different view where I've a back button on clicking that I want to move back to previous view. Same as in iphone "PushviewController" and "Popviewcontroller" please suggest me any way. I've tried with following code but they are not working properly as I need.
-(IBAction)newDocument:(id)sender
{
NSLog(@"<><><>Test");
NewWindow *newWindow = [[[NewWindow alloc] initWithWindowNibName:@"NewWindow"] autorelease];
NSView *view = [[newWindow window] contentView];
NSLog(@"%@",view);
[[self window] setContentView:view];
//[[newWindow window] becomeKeyWindow];
//[NSApp beginSheet:[newWindow window] modalForWindow:[self window] modalDelegate:self didEndSelector:nil contextInfo:nil];
}
- (IBAction)goBack:(NSButton *)sender
{
[[self window] resignKeyWindow];
}