Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there something equivalent of UIActivityViewController in OSX?

I am migrating an application from iOS to OSX, Is there something equivalent of UIActivityViewController in OSX . For things like Facebook, Twitter, mail , Message sharing, I need to do something like;

NSArray *activityItems = [NSArray arrayWithObjects:shareString, shareImage, shareUrl, nil];


UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

activityViewController.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll];


activityViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:activityViewController animated:YES completion:nil];

How can you achieve this in OSX?

like image 716
real 19 Avatar asked Feb 15 '14 04:02

real 19


1 Answers

For OSX , we can use the NSSharingServicePicker which is very similar to UIActivityViewController for iOS:

NSSharingServicePicker *sharingServicePicker = [[NSSharingServicePicker alloc] initWithItems:urls];
sharingServicePicker.delegate = self;

[sharingServicePicker showRelativeToRect:[sender bounds]
                                      ofView:sender
                               preferredEdge:NSMinYEdge];
like image 198
real 19 Avatar answered Oct 04 '22 15:10

real 19