修正了自定义选项卡视图的图像大小我正在使用cell.imageview属性



当我在tabelview单元格上显示图像时,我使用的是自定义tabelview单元,而不是所有图像的大小不同如何在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];

将UIImageViews的contentMode属性设置为UIViewContentModeScaleToFill、UIViewContentModeScaleAspectFit或UIViewContentMode ScaleAspect Fill之一。。。

cell.imageView.contentMode = UIViewContentModeScaleAspectFit;

最新更新