标签:ios
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // 首先判断新浪分享是否可用 if (![SLComposeViewController isAvailableForServiceType:SLServiceTypeSinaWeibo]) { return; } // 创建控制器,并设置ServiceType SLComposeViewController *composeVC = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeSinaWeibo]; // 添加要分享的图片 [composeVC addImage:[UIImage imageNamed:@"Snip20150429_9"]]; // 添加要分享的文字 [composeVC setInitialText:@"share my CSDN Blog"]; // 添加要分享的url [composeVC addURL:[NSURL URLWithString:@"http://blog.csdn.net/u011058732"]]; // 弹出分享控制器 [self presentViewController:composeVC animated:YES completion:nil]; // 监听用户点击事件 composeVC.completionHandler = ^(SLComposeViewControllerResult result){ if (result == SLComposeViewControllerResultDone) { NSLog(@"点击了发送"); } else if (result == SLComposeViewControllerResultCancelled) { NSLog(@"点击了取消"); } }; }
标签:ios
原文地址:http://blog.csdn.net/u011058732/article/details/45374021