我只想分享UIView vie电子邮件,FB或用户想要的屏幕截图! 以下代码仅采用UIView原件,没有输入文本,也没有更改图像
CGRect rect = [mainView bounds];
UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
[mainView.layer renderInContext:context];
UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();