将UIview生成一张高清图片

UIGraphicsBeginImageContextWithOptions(view.frame.size, YES, 1.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = UIImageJPEGRepresentation(image,1.0f);

return [UIImage imageWithData:imageData];

你可能感兴趣的:(将UIview生成一张高清图片)