首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 平面设计 > 图形图像 >

UITableView中改变UIImage分寸的方法

2012-07-23 
UITableView中改变UIImage尺寸的方法UIImage *image [UIImage imageNamed:@YourImage.png]UIImage *t

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即可

热点排行