Reputation: 7778
I have a Cocoa app that calls a sheet from the main window. This works fine from an NSButton on the main window. However, when I call from a MainMenu item, the sheet shows as a separate window. Is this expected behavior, or just expected from me :) I have studied this question ..
I call the sheet with this code:
-(IBAction) showSettingsSheet:(id)sender {
NSLog(@"%s", __FUNCTION__);
settingsSheetController = [[SettingsSheetController alloc] initWithWindowNibName:@"SettingsSheet"];
[settingsSheetController beginSheetModalForWindow:self.window completionHandler:^(NSUInteger returnCode) {
if (returnCode == kSettingsSheetReturnedOk) {
NSLog(@"Settings Returned ok");
} else if (returnCode == kSettingsSheetReturnedCancel) {
NSLog(@"Settings Returned cancel");
} else {
//self.categoryDisplayString = @"Oops!";
NSLog(@" Ooops");
}
}];
}
UPDATE
This is how the Attributes Inspector is set:
Upvotes: 0
Views: 120
Reputation: 15035
Try like this, if you want to display sheet in a mainmenu then try the below steps:-
Uncheck the visible at launch option inside attribute inspector of window which you want to display as a sheet attached the screenshot as well
Upvotes: 1