Screenshot:
- (UIImage *)imageFromImage:(UIImage *)image inRect:(CGRect)rect { CGImageRef sourceImageRef = [image CGImage]; CGImageRef newImageRef = CGImageCreateWithImageInRect(sourceImageRef, rect); UIImage *newImage = [UIImage imageWithCGImage:newImageRef]; return newImage;}
Upload an image of the original file, and then extract the image size.
Set the image as follows:
CGContextTranslateCTM(context, 0.0, self.bounds.size.height); CGContextScaleCTM(context, 1.0, -1.0);
Image Area sawtooth:
CGRect imageRrect = CGRectMake(0, 0,imageView.frame.size.width, imageView.frame.size.height); UIGraphicsBeginImageContext(imageRrect.size); [imageView.image drawInRect:CGRectMake(1,1,imageView.frame.size.width-2,imageView.frame.size.height-2)]; imageView.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
This article is from the "Frank" blog. For more information, contact the author!