iOS-twitter分享图片界面卡死的问题

图片宽高超过一定比例,界面卡死
现在不知道具体多少,试验获得高/宽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();
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容