In my application want to handle click of UIActivityTypePostToFacebook. So how to achieve this click event. Please check my code : #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
NSString *aText = @"Google";
UIImage *aPhoto = [UIImage imageNamed:@"3.png"];
NSURL *website = [NSURL URLWithString:@"http://www.google.com/"];
NSArray *objectsToShare = @[aText, aPhoto, website];
NSArray * applicationActivities = nil;
UIActivityViewController * activityViewController = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:applicationActivities];
activityViewController.excludedActivityTypes = @[
UIActivityTypePostToWeibo,
UIActivityTypeAssignToContact,
UIActivityTypeAirDrop,
UIActivityTypeAddToReadingList,
UIActivityTypeCopyToPasteboard,
UIActivityTypeSaveToCameraRoll,
UIActivityTypePrint,
UIActivityTypePostToFlickr,
UIActivityTypePostToTencentWeibo,
// Whatever you want to exclude
];
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")){
activityViewController.popoverPresentationController.sourceView =
self.view;
}
if(isiPhone)
{
[self presentViewController:activityViewController animated:YES completion:nil];
}
else{
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityViewController];
[popup presentPopoverFromRect:CGRectMake(0, screenheight, 768, 0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}