Creating NSApp inside another nsviewcontroller

Posted by DesperateLearner on Stack Overflow See other posts from Stack Overflow or by DesperateLearner
Published on 2012-12-11T05:01:19Z Indexed on 2012/12/11 5:03 UTC
Read the original article Hit count: 127

Filed under:
|

I have opened my mac app in a new nsviewcontroller

 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
 self.masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];


[self.window.contentView addSubview:self.masterViewController.view];
self.masterViewController.view.frame = ((NSView*)self.window.contentView).bounds;

}

Masterviewcontroller has a customized view in the .xib file. When I need to create an NSApp sheet in this NSViewController for another, I'm calling

  [NSApp beginSheet:_newDataWindow    modalForWindow:window   modalDelegate:self didEndSelector:nil contextInfo:nil];

I have to use 'window' for beginSheetModalForWindow. But how do I call it from another NSViewController. I end up with compilation error.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about osx