// iphone 截屏方法
- (UIImage *)imageFromView:(UIView *)theView
{
UIGraphicsBeginImageContext(theView.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[theView.layer renderInContext: context];
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
当需要将当前界面转化为image时,调用上述方法
//如果需要分享回调,请将delegate对象设置self,并实现下面的回调方法
- (void)shareUM
{
[UMSocialData defaultData].extConfig.title = @"分享的title";
[UMSocialData defaultData].extConfig.qqData.url = @"http://baidu.com";
[UMSocialSnsService presentSnsIconSheetView:self
appKey:@"507fcab25270157b37000010"
shareText:@"友盟社会化分享让您快速实现分享等社会化功能,http://umeng.com/social"
shareImage:[self imageFromView:self.view];
shareToSnsNames:@[UMShareToWechatSession,UMShareToWechatTimeline,UMShareToSina,UMShareToQQ,UMShareToQzone]
delegate:self];
}