nsmenu

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

How to set the font of NSMenu/NSMenuItems?

末鹿安然 提交于 2020-01-13 10:47:10
问题 I can’t figure out how to set the font/styling of my NSMenuItems in my NSMenu. I tried the setFont method on the NSMenu but it doesn’t seem to have any effect on the menu items. NSMenuItem doesn’t seem to have a setFont method. I would like for them all to have the same font/style so I would hope there’s just one property I can set somewhere. 回答1: They can have an attributed title, so you can set an attributed string as title with all it's attributed, font included: NSMutableAttributedString*

How do I disable the Show Tab Bar menu option in Sierra apps?

≡放荡痞女 提交于 2020-01-12 13:41:15
问题 I've got an app that uses a Toolbar in a NSWindow. I don't want users to be able to customize this toolbar for aesthetic reasons. In Sierra there's a new Menu option that gets inserted into "Menu > View" called Show Tab Bar . How do I disable this? Enabling it only seems to increase the tool bar's height as I don't have extra labels showing under the icons. 回答1: You can also do this on IB, on the Window’s attributes inspector 回答2: On 10.12, you need to now set the following when the window is

Swift: Right/Left click on NSStatusBar

ぃ、小莉子 提交于 2020-01-03 05:58:08
问题 I'm building a NSStatusBar app and want to call different functions depending on if the user clicked left- or right on the icon. Here is what I have so far: let statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(-1) func applicationDidFinishLaunching(aNotification: NSNotification) { let icon = NSImage(named: "statusIcon") icon?.setTemplate(true) statusItem.image = icon statusItem.menu = statusMenu } With this it shows up the statusMenu by every click. How can I distinguish the