1

UIActivityViewController用于将图像分享到社交网络。我需要将我的图像发布到朋友的墙上。是否可以使用 UIActivityViewController 将图像发布到朋友的墙上。

4

1 回答 1

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];
于 2013-08-01T06:15:55.727 回答