3

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];
}
Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
Exploring
  • 925
  • 6
  • 18
  • 4
    I don't have an answer for your question but I would like to suggest that, if you're interested in learning to write Mac applications, you should make them behave like Mac applications instead of iPhone ones. – Phillip Mills Jan 05 '13 at 12:58
  • 2
    From the opposite direction, if you're writing Mac apps to behave like iOS apps, you'll want to look [Chameleon](http://chameleonproject.org/). – Nate Chandler Jan 07 '13 at 00:24
  • http://stackoverflow.com/a/22409798/1208191 – Sunil Chauhan Sep 10 '15 at 11:43

0 Answers0