读书人

UITableView中改变UIImage分寸的方法

发布时间: 2012-07-23 09:42:20 作者: rapoo

UITableView中改变UIImage尺寸的方法

UIImage *image = [UIImage imageNamed:@"YourImage.png"];            UIImage *tempImage = nil;            CGSize targetSize = CGSizeMake(48,48); //你想要的图片尺寸            UIGraphicsBeginImageContext(targetSize);            CGRect thumbnailRect = CGRectMake(0, 0, 0, 0);            thumbnailRect.origin = CGPointMake(0.0,0.0);            thumbnailRect.size.width  = targetSize.width;            thumbnailRect.size.height = targetSize.height;            [image drawInRect:thumbnailRect];            tempImage = UIGraphicsGetImageFromCurrentImageContext();            UIGraphicsEndImageContext();            cell.img.image = tempImage; //这里我是自定义了cell,将Image重置为新的tempImage即可

读书人网 >图形图像

热点推荐