Skip to content

Instantly share code, notes, and snippets.

@dniswhite
Created April 20, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dniswhite/b2105980148d2c49d073 to your computer and use it in GitHub Desktop.
Save dniswhite/b2105980148d2c49d073 to your computer and use it in GitHub Desktop.
how to share stuff to social networks with UIActivityViewController
-(void) sharePicture {
NSString *textToShare = @"Check out this picdoodle that I created.";
UIImage * image = [self getPicture];
NSArray *objectsToShare = @[textToShare, image];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
NSArray *excludeActivities = @[UIActivityTypeAirDrop,
UIActivityTypePrint,
UIActivityTypeAssignToContact,
UIActivityTypeAddToReadingList,
UIActivityTypePostToVimeo];
activityVC.excludedActivityTypes = excludeActivities;
[self presentViewController:activityVC animated:YES completion:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment