Skip to content

Instantly share code, notes, and snippets.

@mikeabdullah
Created November 12, 2011 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeabdullah/1360468 to your computer and use it in GitHub Desktop.
Save mikeabdullah/1360468 to your computer and use it in GitHub Desktop.
Restoring an optional, secondary document window
- (void)restoreDocumentWindowWithIdentifier:(NSString *)identifier state:(NSCoder *)state completionHandler:(void (^)(NSWindow *, NSError *))completionHandler;
{
if ([identifier isEqualToString:@"Secondary"])
{
// Rely on main controller to create secondary window
if (![[self windowControllers] count]) [self makeWindowControllers];
MyWindowController *mainController = [[self windowControllers] objectAtIndex:0];
completionHandler([[mainController secondaryWindowController] window], nil);
}
else
{
[super restoreDocumentWindowWithIdentifier:identifier state:state completionHandler:completionHandler];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment