• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Correct way to implement a "Share" toolbar item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Why would insertSublayer:atIndex: botch animation of CAShapeLayer?
  • Next by Date: Re: Understanding NSTask
  • Previous by thread: Why would insertSublayer:atIndex: botch animation of CAShapeLayer?
  • Next by thread: CoreText and a trailing space
  • Index(es):
    • Date
    • Thread