我想听听你的建议。可以在 OSX
上右键单击添加新项目吗?例如,我在 safari、TextEdit、Notes、Pages、Preview 中选择任何单词,我想将该单词发送到服务器并获得响应。有可能的?你能给我一些提示我应该如何开始吗?
最佳答案
你可以尝试这样的事情:
- (void)mouseDown:(NSEvent *)theEvent {
NSMenu *theMenu = [[NSMenu alloc] initWithTitle:@"Contextual Menu"];
[theMenu insertItemWithTitle:@"Beep" action:@selector(beep:) keyEquivalent:@"" atIndex:0];
[theMenu insertItemWithTitle:@"Honk" action:@selector(honk:) keyEquivalent:@"" atIndex:1];
[NSMenu popUpContextMenu:theMenu withEvent:theEvent forView:self];
}
了解更多 here .
关于objective-c - 右键单击 OSX 新项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34750552/