圖片寬高超過一定比例,界面卡死
現(xiàn)在不知道具體多少,試驗(yàn)獲得高/寬1.8點(diǎn)多可以,所以超出比例后進(jìn)行處理即可
- (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();
}