-(UIImage*)getSubImage:(CGRect)rect cgImage:(UIImage*)CGImage
{
CGImageRef subImageRef = CGImageCreateWithImageInRect(CGImage.CGImage, rect);
CGRect smallBounds = CGRectMake(0, 0, CGImageGetWidth(subImageRef), CGImageGetHeight(subImageRef));
UIGraphicsBeginImageContext(smallBounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextDrawImage(context, smallBounds, subImageRef);
UIImage* smallImage = [UIImage imageWithCGImage:subImageRef];
UIGraphicsEndImageContext();
return smallImage;
}
UIimage 剪切
猜你喜欢
转载自blog.csdn.net/investzhu/article/details/53895374
今日推荐
周排行