我有这个图像渲染功能,当我渲染它时,它会导致主/UI线程阻塞/卡顿。
有哪些方法可以不阻塞线程并在 iOS 中的不同线程上渲染?有本地 API 可以帮助您吗?
更新了代码:
+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
    //UIGraphicsBeginImageContext(newSize);
    UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}
function
{
    UIImage *shrinkedImage = [ThisClass imageWithImage:screenShotImage scaledToSize:shrinkImageToSize];
    UIImage * rotatedImage = [[UIImage alloc] initWithCGImage: shrinkedImage.CGImage
                                                        scale: 1.0
                                                  orientation: UIImageOrientationRight];
}
谢谢