How to get rid of Enter Full Screen menu item?

余生颓废 提交于 2020-03-23 02:23:20

问题


In my Mac OS X app I deleted all default menu items, added my own.

But in View menu at the bottom I can still see Enter Full Screen menu item, whilst in storyboard there is no such menu item.

I've tried to delete the entire View menu, but now it migrated to Window menu. Even though it's disabled, I would still like to get rid of it entirely if possible.


回答1:


The release notes for AppKit for 10.11 suggest you can use the NSUserDefault NSFullScreenMenuItemEverywhere.

Full Screen Menu Item

AppKit automatically creates an "Enter Full Screen" menu item after the application finishes launching if an equivalent menu item isn't found. If this menu item should not be created for your app, before NSApplicationDidFinishLaunchingNotification is sent you may set the NSFullScreenMenuItemEverywhere default to NO.

- (void)applicationWillFinishLaunching:(nonnull NSNotification *)notification {
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
}



回答2:


For Swift 4

func applicationWillFinishLaunching(_ notification: Notification) {
    UserDefaults.standard.set(false, forKey: "NSFullScreenMenuItemEverywhere")
}


来源:https://stackoverflow.com/questions/52154977/how-to-get-rid-of-enter-full-screen-menu-item

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!