在应用程序中截取屏幕截图,然后将其放入UIImageView中,通常分辨率为

|| 将iOS模拟器放大至100%后,我注意到由我使用该代码通过对视图的“屏幕截图”进行“截屏”制作的图标均处于正常分辨率,而其他所有内容似乎都在视网膜分辨率:
UIGraphicsBeginImageContext(rect.size);
[object.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
任何想法如何使其成为视网膜分辨率?     
已邀请:
        
UIGraphicsBeginImageContext()
不支持Retina显示。 在iOS 4上,您需要改用
UIGraphicsBeginImageContextWithOptions()
,将
0
作为最后一个参数传递,以使iOS根据设备的屏幕分辨率自动缩放它:
UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);
[object.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
    

要回复问题请先登录注册