-(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;
}
网友评论