1
有沒有辦法來設置在單元格的內容和imagaView:有沒有辦法從didSelectRowAtIndexPath設置單元格內容和imagaView?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
?
我想在更新tabledataSource之前更新單元格。
有沒有辦法來設置在單元格的內容和imagaView:有沒有辦法從didSelectRowAtIndexPath設置單元格內容和imagaView?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
?
我想在更新tabledataSource之前更新單元格。
你可以讓你的細胞這樣的參考...
UITableViewCell *selectedCell = [self cellForRowAtIndexPath:indexPath];
然後做類似的修改......
selectedCell.titleLabel.text = @"new title";
selectedCell.imageView.image = [UIImage imageNamed:@"newImage.png"];
你也可能需要調用來更新該小區'[selectedCell setNeedsDisplay]' – Bartek
我不認爲你需要調用setNeedsDisplay。以上應該足夠了, – honcheng