标签:
- (UIImage *)clipImage: (UIImage *)image inRect: (CGRect) rect
{
//返回image中rect范围内的图片
CGImageRef imageRef = CGImageCreateWithImageInRect(image.CGImage, rect);
UIImage *subImage = [UIImage imageWithCGImage:imageRef];
return subImage;
}
iv.image = [self clipImage:[UIImage imageNamed:@"king2"] inRect:CGRectMake(100*(i%3), 100*(i/3), 100, 100)];
标签:
原文地址:http://www.cnblogs.com/wanghengheng/p/4839777.html