我正在使用UITableView顯示多行數據:textLabel.text名稱,imageView顯示狀態(在線/離線),detailTextLabel其他信息。更新UITableView的imageView/detailTextLabel
ex。在的cellForRowAtIndexPath
cell.imageView.image = [UIImage imageNamed:@"checking.png"];
cell.textLabel.text = @"NAME";
cell.detailTextLabel.text = @"Checking...";
如何更新從另一個功能imageView.image和detailTextLabel.text。有沒有UITableView方法? 我猜我需要使用IndexPath行來定位單元格。也許爲每個imageView和detailTextLabel分配標籤?
謝謝。
但是,如何定位行(IndexPath.row)並更新detailTextLabel和imageView.image?你能提供一些示例代碼嗎?謝謝。 – ialphan 2013-05-14 16:00:57
您正在實施表視圖數據源方法嗎? tableView:cellForRowAtIndexPath: – Wain 2013-05-14 17:05:31
是的,我結束了使用這樣的事情:UITableViewCell * cell0 = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];其中indexPathForRow和inSection是固定的。 Frm,我能夠像這樣更新cell0 cell0.imageView.image = [UIImage imageNamed:@「connected.png」]; – ialphan 2013-05-14 22:14:18