从菜单项调用popover

时间:2015-02-23 11:37:44

标签: objective-c osx-mavericks

我是可可语言的新手。我的要求: 点击菜单项时应打开Popover。我已动态创建菜单项。

1

NSMenu *theMenu =[[NSMenu alloc] initWithTitle:@"Contextual Menu"];
        [theMenu insertItemWithTitle:@"Insert Comments" action:@selector(insertComments:) keyEquivalent:@"" atIndex:0];

2

- (IBAction)insertComments:(id)sender
{

    [self.popover showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMaxXEdge];

}

我收到此错误-[NSMenuItem bounds]: unrecognized selector sent to instance 0x600000ebdee0 什么应该发送给showItem的showRelativeToRect。

0 个答案:

没有答案