//UIGraphicsBeginImageContext(CGSizeMake(view.bounds.size.width, view.bounds.size.height)); //刚方法无scale,所以会模糊
//UIGraphicsBeginImageContextWithOptions(区域大小, 是否是非透明的, 屏幕密度);
UIGraphicsBeginImageContextWithOptions(view.frame.size, YES, UIScreen.mainScreen.scale);
[self.portraitBar.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
网友评论