macOS 添加Dock菜单
2019-08-23 本文已影响0人
mapg
//NSApplicationDelegate 在dock上添加菜单
- (NSMenu *)applicationDockMenu:(NSApplication *)sender {
NSMenu *dockMenu = [[NSMenu alloc] initWithTitle:@"嗨新房"];
[dockMenu setAutoenablesItems:NO];
NSMenuItem *newItem0 = [[NSMenuItem alloc]
initWithTitle:@"修改头像"
action:@selector(takePhonto)
keyEquivalent:@""];
NSMenuItem *newItem1 = [[NSMenuItem alloc]
initWithTitle:@"截屏"
action:@selector(grapScreen)
keyEquivalent:@""];
[newItem0 setTarget: self];
[newItem1 setTarget: self];
[dockMenu addItem:newItem0];
[dockMenu addItem:newItem1];
return dockMenu;
}
-(void)takePhonto{
//
}
//截屏
-(void)grapScreen{
// if (App_Delegate.isLogin) {
// [Tools grabScreen];
// }else{
// [self showAlertWithMessageStr:@"提示" info:@"登陆后才能进行此操作"];
// }
}
image.png