美文网首页
OC裁剪图片

OC裁剪图片

作者: Funcy1Day | 来源:发表于2017-03-30 17:58 被阅读122次

-(UIImage *)clipImageWithImage:(UIImage * )image isLeftImage:(BOOL)isLeft{

CGRect imageRect = CGRectMake(0, 0, image.size.width/2, image.size.height);

if (!isLeft) {

imageRect.origin.x = image.size.width/2;

}

CGImageRef  imgRef = CGImageCreateWithImageInRect(image.CGImage, imageRect);

UIImage * clipImage = [UIImage imageWithCGImage:imgRef];

CGImageRelease(imgRef);

return clipImage;

}

相关文章

网友评论

      本文标题:OC裁剪图片

      本文链接:https://www.haomeiwen.com/subject/zjypottx.html