我有这个图像渲染功能,这是导致主/用户界面线程阻止/口吃时,我渲染它。如何呈现图像而不阻挡用户界面?
什么方法可以阻止线程并在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];
}
感谢
请发表你使用渲染图像的代码。 – mark
用用于渲染的代码更新。 – mskw
你为什么要调整大小?如果您只是想在屏幕上显示它,请使用图像视图并将其设置为缩放,在其上应用旋转变换,然后以合理的性能完成几个语句。 –