UIImage 剪裁的方法

在UIImage上扩展一个函数   @interface UIImage (Resize) - (UIImage *)croppedImage:(CGRect)bounds; @end   @implementation UIImage (Resize)   // Returns a copy of this image that is cropped to the given bounds. // The bounds will be adjusted using CGRectIntegral. // This method ignores the image's imageOrientation setting. - (UIImage *)croppedImage:(CGRect)bounds { CGImageRef imageRef = CGImageCreateWithImageInRect([self CGImage], bounds); UIImage *croppedImage = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef); return croppedImage; } @end

posted on 2013-04-10 10:48  流れ星ーー  阅读(131)  评论(0编辑  收藏  举报

导航