图片宽高超过一定比例,界面卡死
现在不知道具体多少,试验获得高/宽1.8点多可以,所以超出比例后进行处理即可
- (void)createShareImage {
UIImage *image = [BFLImage screenshotWithView:_contentView viewFrame:_contentView.bounds inRect:_contentView.bounds applyBlur:NO];
UIImage *imageQR = [CDCommon loadAppImage:@"speechShareQR"];
CGFloat shareImageW = image.size.width;
CGFloat shareImageH = image.size.height;
if (shareImageH / shareImageW > 1.8) {
shareImageH = shareImageW * 1.8;
}
CGFloat qrW = shareImageW;
CGFloat qrH = 120 * (shareImageW / imageQR.size.width);
UIGraphicsBeginImageContext(CGSizeMake(shareImageW, shareImageH));
[image drawInRect:CGRectMake(0, 0, shareImageW, shareImageH)];
[imageQR drawInRect:CGRectMake(0, shareImageH-qrH, qrW, qrH)];
_shareImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}