-drawViewHierarchyInRect:afterScreenUpdates:
是iOS 7中快速查看视图层次结构的快照方式.
它需要快照,但分辨率为@ 1x.iPhone 5S上的快照看起来像素化且模糊.我没有转换创建快照的视图.
我不想模糊它,并希望在屏幕上看到良好的质量.我是如何捕获它的:
UIGraphicsBeginImageContext(self.bounds.size); [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
我也尝试过:
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.contentScaleFactor);
仍然呈现低@ 1x质量.
有没有其他方法来配置图像上下文,所以它是@ 2x分辨率?
正确的是:
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0.0f);