根据indexPath.row修改cell图片

通常我都用 cell.imageView.image = [UIImage imageNamed:@"image.png"]; 修改cell的图片。

但是如果只知道indexPath.row的情况下应该怎么修改?

我试过:

[self.tableView cellForRowAtIndexPath:0].imageView.image = [UIImage imageNamed:@"image.png"];
用
NSIndexPath *index = [NSIndexPath indexPathForItem:row inSection:section];
获取NSIndexPath
用 [self.tableView cellForRowAtIndexPath:index].imageView.image = [UIImage imageNamed:@"image"]; 
//image.png 这种写法不太规范,因该直接用image这样满足2倍图的自动选择

试试:

  UITableVieCell *cell = [self.tableView cellForRowAtIndexPath:0];
  cell.imageView.image = ...