How to crop 6% off on each side?
I am trying to crop off about 6% of a UIImage. However, it's wanting to revert back to a square. Here's my code:
CGRect newSize = CGRectMake(image.size.width * .06, 0.0, image.size.width * 0.89, image.size.height);
CGImageRef tmp = CGImageCreateWithImageInRect([image CGImage], ne开发者_开发问答wSize);
UIImage *finalImage = [UIImage imageWithCGImage:tmp];
CGImageRelease(tmp);
Please help!
This article is a reference to me when it comes to resizing images in iOS.
Not only he provides a bunch of methods to be used as a category for UIImage, but also explains how to accomplish resizing, cropping, round corners, and more.
精彩评论