我使用UIActivityViewController
将共享图片用于社交网络。我需要将我的图像发布到朋友的墙上。是否可以使用UIActivityViewController将图像发布到朋友的墙上。
答案 0 :(得分:0)
使用NSData
,您可以将图片添加到UIActivityViewController
。尝试下面的一个。
NSString *text = @"your text goes here";
NSData *Da = UIImageJPEGRepresentation([UIImage imageNamed:@"Icon.png"], 1.0);
NSArray * activityItems = @[text,Da];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:[NSArray arrayWithObjects:nil]];
activityVC.excludedActivityTypes = @[UIActivityTypePostToWeibo]; //or whichever you don't need
[activityVC setCompletionHandler:^(NSString *activityType, BOOL completed) {
}];
[self presentViewController:activityVC animated:YES completion:nil];