iOS UITableViewCell 中 调整imageView 的图片大小

//设置图片
[cell.imageView setImageWithURL:[YunYaoApi getServerImage:user.avatar] placeholderImage:[UIImage imageNamed:@"focalme"]];

//调整大小

CGSize itemSize = CGSizeMake(40, 40);
UIGraphicsBeginImageContextWithOptions(itemSize, NO, UIScreen.mainScreen.scale);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[cell.imageView.image drawInRect:imageRect];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

你可能感兴趣的:(ios)