IOS 截取当前高清屏幕

高清图生成
- (UIImage *)convertViewToImage {
UIView *v = self.view;
CGSize s = v.bounds.size;
//第一个参数表示区域大小。第二个参数表示是否是非透明的。如果需要显示半透明效果,需要传NO,否则传YES。第三个参数就是屏幕密度了
UIGraphicsBeginImageContextWithOptions(s, NO, [UIScreen mainScreen].scale);
[v.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage*image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}

猜你喜欢

转载自blog.csdn.net/goods_boy/article/details/79740108