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即可
UITableView中改变UIImage尺寸的方法
最新推荐文章于 2019-01-30 14:50:06 发布