【发布时间】:2017-08-02 11:48:54
【问题描述】:
没有情节提要,此代码可以完美运行。它打开 NSMenu
-(IBAction)openExportCompletePaletteMenu:(id)sender {
NSPoint point = [self.window convertRectToScreen:((NSButton*)sender).frame].origin;
[self.menu popUpMenuPositioningItem:nil atLocation:point inView:nil];
}
显然我在 ViewController 中使用故事板更改了 self.window whit:
[[NSApplication sharedApplication].windows objectAtIndex:0]
or
[[NSApplication sharedApplication] mainWindow]
但似乎不是正确的选择。是否有可能使用情节提要不再可能?这听起来很糟糕。
【问题讨论】:
标签: objective-c macos nsmenu