DaffodilGirl 2013-05-27 05:34 采纳率: 0%
浏览 3010
已采纳

根据indexPath.row修改cell图片

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

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

我试过:

[self.tableView cellForRowAtIndexPath:0].imageView.image = [UIImage imageNamed:@"image.png"];
  • 写回答

2条回答 默认 最新

  • HelloAldis 2013-05-27 16:28
    关注
    用
    NSIndexPath *index = [NSIndexPath indexPathForItem:row inSection:section];
    获取NSIndexPath
    用 [self.tableView cellForRowAtIndexPath:index].imageView.image = [UIImage imageNamed:@"image"]; 
    //image.png 这种写法不太规范,因该直接用image这样满足2倍图的自动选择
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?