修复自定义表视图上的图像大小我正在使用cell.imageview属性

时间:2012-03-21 13:53:09

标签: iphone

当我在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];

1 个答案:

答案 0 :(得分:0)

将UIImageViews上的contentMode属性设置为UIViewContentModeScaleToFill,UIViewContentModeScaleAspectFit或UIViewContentModeScaleAspectFill ...

之一
cell.imageView.contentMode = UIViewContentModeScaleAspectFit;
相关问题