【发布时间】:2012-05-09 02:59:44
【问题描述】:
我正在使用以下代码截取我的一个视图控制器的屏幕截图,然后稍后在另一个视图中显示它。对于 UIGraphicsBeginImageContextWithOptions 方法,如果给它 1.0 作为比例,结果图像会看起来很模糊;但是如果给它 0.0 作为比例,结果图像会比屏幕大,并且在另一个视图中显示时可以看到它的一部分。有没有办法解决这个问题?
CGSize imageSize = [[UIScreen mainScreen] bounds].size;
if (NULL != UIGraphicsBeginImageContextWithOptions) {
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 1.0);
} else {
UIGraphicsBeginImageContext(imageSize);
}
[_displayViewController.view.layer renderInContext:UIGraphicsGetCurrentContext()];
// Retrieve the screenshot image
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
【问题讨论】:
标签: iphone uiimage blurry quartz-core