第三方汇总 (效果图) - (IBAction)shareByActivity:(id)sender { NSArray *activityItems; if (self.sharingImage != nil) { activityItems = @[self.sharingText, self.sharingImage]; } else { activityItems = @[self.sharingText]; } UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil]; [activityController setCompletionHandler:^(NSString *activityType, BOOL completed) { NSLog(@"start completion block %@",activityType); NSLog(@"completed %d",completed); }]; [self presentViewController:activityController animated:YES completion:nil]; } 分享到微博 - (IBAction)shareToWeibo:(id)sender { [slComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) { NSLog(@"start completion block"); NSString *output; switch (result) { case SLComposeViewControllerResultCancelled: output = @"Action Cancelled"; break; case SLComposeViewControllerResultDone: output = @"Post Successfull"; break; default: break; } if (result != SLComposeViewControllerResultCancelled) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Weibo Message" message:output delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; } }]; if([SLComposeViewController isAvailableForServiceType:SLServiceTypeSinaWeibo]) { slComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeSinaWeibo]; [slComposerSheet setInitialText:self.sharingText]; [slComposerSheet addImage:self.sharingImage]; [slComposerSheet addURL:[NSURL URLWithString:@"http://www.weibo.com/"]]; [self presentViewController:slComposerSheet animated:YES completion:nil]; } } facebook和twitter同理
你必须 登录后 才能对文章进行评论!