core code
View generating image method
UIGraphicsBeginImageContext(view.bounds.size); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
Generate clear pictures
#pragma mark generate image - (UIImage *)GetmakeImageWithView:(UIView *)view andWithSize:(CGSize)size { // The following method, the first parameter indicates the area size. The second parameter indicates whether it is non-transparent. If you need to display the translucent effect, you need to pass NO, otherwise pass YES. The third parameter is the screen density, and the key is the third parameter [UIScreen mainScreen].scale. UIGraphicsBeginImageContextWithOptions(size, NO, 0.0 ); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; }