如何摆脱 Enter Full Screen 菜单项?
How to get rid of Enter Full Screen menu item?
在我的 Mac OS X 应用程序中,我删除了所有默认菜单项,添加了我自己的菜单项。
但是在底部的View
菜单中我仍然可以看到Enter Full Screen
菜单项,而在情节提要中没有这样的菜单项。
我曾尝试删除整个 View
菜单,但现在它已迁移到 Window
菜单。尽管它已被禁用,但如果可能的话,我仍然希望完全摆脱它。
AppKit for 10.11 的 release notes 建议您可以使用 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"];
}
对于Swift 4
func applicationWillFinishLaunching(_ notification: Notification) {
UserDefaults.standard.set(false, forKey: "NSFullScreenMenuItemEverywhere")
}
在我的 Mac OS X 应用程序中,我删除了所有默认菜单项,添加了我自己的菜单项。
但是在底部的View
菜单中我仍然可以看到Enter Full Screen
菜单项,而在情节提要中没有这样的菜单项。
我曾尝试删除整个 View
菜单,但现在它已迁移到 Window
菜单。尽管它已被禁用,但如果可能的话,我仍然希望完全摆脱它。
AppKit for 10.11 的 release notes 建议您可以使用 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"];
}
对于Swift 4
func applicationWillFinishLaunching(_ notification: Notification) {
UserDefaults.standard.set(false, forKey: "NSFullScreenMenuItemEverywhere")
}