0
没有故事板这个代码完美地工作。它打开NSMenu从NSButton用故事板打开NSMenu
-(IBAction)openExportCompletePaletteMenu:(id)sender {
NSPoint point = [self.window convertRectToScreen:((NSButton*)sender).frame].origin;
[self.menu popUpMenuPositioningItem:nil atLocation:point inView:nil];
}
随着一个视图控制器故事板很明显,我改变了self.window
白衣:
[[NSApplication sharedApplication].windows objectAtIndex:0]
or
[[NSApplication sharedApplication] mainWindow]
,但似乎并不正确的选择。故事板有可能不再可能吗?这听起来很糟糕。
谢谢!并且'@property(strong)IBOutlet'不是'(弱)' – Joannes