当我在tableview单元格上显示图像时,我使用自定义tableview单元格比所有图像大小不同如何在iphone中显示相同大小的所有图像
NSString *str=[self.uploadimagearry objectAtIndex:indexPath.row];
NSURL *uploadimageURL = [NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
// NSData *imgdata=[NSData dataWithContentsOfURL:uploadimageURL];
//UIImage * uploadimage = [UIImage imageWithData:imgdata];
cell.imageView.frame=CGRectMake(0, -15, 40, 35);
//[[cell imageView] setContentMode:UIViewContentModeScaleAspectFit];
cell.autoresizesSubviews=NO;
[cell.imageView setImageWithURL:uploadimageURL placeholderImage:[UIImage imageNamed:@"loading.png"]];
cell.textLabel.text=[imageidarry objectAtIndex:indexPath.row];
答案 0 :(得分:0)
将UIImageViews上的contentMode属性设置为UIViewContentModeScaleToFill,UIViewContentModeScaleAspectFit或UIViewContentModeScaleAspectFill ...
之一cell.imageView.contentMode = UIViewContentModeScaleAspectFit;