iOS常见的截图模糊问题解决办法
主要原因:是在iOS7 的分辨率 会改为另外一种代替的方法
iOS7之前是UIGraphicsBeginImageContext
iOS7之后是UIGraphicsBeginImageContextWithOptions
+(UIImage*)captureScreen:(UIView*)viewToCapture
{UIGraphicsBeginImageContextWithOptions(viewToCapture.bounds.size, NO, 0.0);
[viewToCapture.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}
UIGraphicsBeginImageContext(viewToCapture.bounds.size);//模糊
UIGraphicsBeginImageContextWithOptions(viewToCapture.bounds.size, NO, 0.0);//原图