在uitableviewcell
按钮点击事件中共享图片,以便在uitableview imageview图像共享中共享图像
-(void)yourButtonClicked:(UIButton*)sender
{
CustomTableViewCell *clickedCell = (CustomTableViewCell *)[[sender superview] superview];
NSIndexPath *clickedButtonIndexPath = [Mytableview indexPathForCell:clickedCell];
int selectedIndexPath = clickedButtonIndexPath.row;
NSLog(@"SelectedIndexPath: %d",selectedIndexPath);
UIImageView * imageshow;
UIImage* imge = [[arry objectAtIndex:selectedIndexPath]valueForKey:@"post_image"];
NSLog(@"imahe : = %@",imge);
imageshow.image = imge;
NSString *textToShare = @"Vocabmeme image";
UIImage *imageToShare = imageshow.image;
NSArray *itemsToShare = @[textToShare,imageToShare];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll]; //or whichever you don't need
[self presentViewController:activityVC animated:YES completion:nil];
}