To add a sharing button to Mountain Lion:
1) Add an NSButton , e.g. shareButton .
2) Add a standard image for this button:
[shareButton setImage:[NSImage imageNamed:NSImageNameShareTemplate]]; [shareButton sendActionOn:NSLeftMouseDownMask];
3) In the "on click" action, enter NSSharingServicePicker :
NSSharingServicePicker *sharingServicePicker = [[NSSharingServicePicker alloc] initWithItems:urls]; sharingServicePicker.delegate = self; [sharingServicePicker showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge];
4) Finally, apply the NSSharingServicePickerDelegate methods to configure the available selection tools.
Dev
source share