NSSharingServicePickerDelegate Protocol Reference
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in OS X v10.8 and later. |
| Declared in | NSSharingService.h |
Overview
The NSSharingServicePickerDelegate protocol allows customization of the service picker behavior.
See NSSharingServicePicker Class Reference for more information.
Instance Methods
sharingServicePicker:delegateForSharingService:
Invoked to provide the delegate to the sharing service when the user has selected a service.
Parameters
- sharingServicePicker
The sharing service picker.
- sharingService
The selected sharing service.
Return Value
An object that implements the NSSharingServiceDelegate protocol the sharing service should use for this item’s transfer.
Availability
- Available in OS X v10.8 and later.
Declared In
NSSharingService.hsharingServicePicker:didChooseSharingService:
Invoked when the user has selected a service and before it is executed.
Parameters
- sharingServicePicker
The sharing service picker.
- service
The sharing service the user selected. Invoked to give the delegate to the sharing service that is about to be executed.
Availability
- Available in OS X v10.8 and later.
Declared In
NSSharingService.hsharingServicePicker:sharingServicesForItems:proposedSharingServices:
Invoked to allow the delegate to customize exactly what appears in the sharing service picker before it is presented.
Parameters
- sharingServicePicker
The sharing service picker.
- items
The items to share.
- proposedServices
The proposed services to share the content.
Return Value
The sharing services to use.
Discussion
The delegate can reorder, remove default services or add custom services before the picker is presented. It's possible to add custom services by mutating the proposedSharingServices array and adding new NSSharingService instances.
The following is an example:
NSMutableArray *sharingServices = [proposedServices mutableCopy]; |
NSSharingService * customService = [[[NSSharingService alloc] initWithTitle:@"Service Title" |
image:image alternateImage:alternateImage |
handler:^{ |
[self doCustomServiceWithItems:items]; |
}] autorelease]; |
[sharingServices addObject:customService]; |
return [sharingServices autorelease]; |
Availability
- Available in OS X v10.8 and later.
Declared In
NSSharingService.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-07-23)