How to get rid of Enter Full Screen menu item?

2019-08-10 07:38发布

问题:

In my MacOS 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 entire View menu, but now it migrated to Window menu. Even though it's disabled, but still I would like to get rid of it, if possible.

回答1:

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

- (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")
}