Correct way to implement a "Share" toolbar item
Correct way to implement a "Share" toolbar item
- Subject: Correct way to implement a "Share" toolbar item
- From: Graham Cox <email@hidden>
- Date: Tue, 09 Apr 2013 11:32:25 +1000
I'm adding sharing to my OSX app, and I want to use a toolbar item to invoke it.
This ends up calling [NSSharingServicePicker showRelativeToRect: ofView:preferredEdge:]; which shows a menu of available sharing services for the data, allows me to select one and handles the rest.
Unfortunately, this method doesn't fit the situation when called by a NSToolbarItem. The toolbar item calls an action method which calls the above, but with a toolbar item as sender there is no rect nor a view that can be obtained to supply the method.
In addition, the method above logs the following complaint: Warning: -[NSSharingServicePicker showRelativeToRect: ofView: preferredEdge:] should not be called on mouseUp
Please configure the sender with -[NSControl sendActionOn:NSLeftMouseDownMask];
It's not possible to configure a NSToolbarItem in this way - it is not a NSControl subclass.
I've tried making the toolbar item a popup (doesn't work at all) and a button (works, but the icon ends up tiny and it does not look right as a button).
Has anyone got this to work? What's the correct way to make a "Share" toolbar item?
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden