我有一個UITableView
,它由多個自定義UITableViewCells
組成。如何更新didSelectRowAtIndex上的自定義UITableViewCell的屬性?
當表didSelectRowAtIndexPath
方法火災,如果indexPath.row
等於2,我想在此行的單元格內更新UILabel
。
我的想法是使用以下幾行;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.row == 2){
myCustomCellView *cell = [self.essentialsTableView cellForRowAtIndexPath:indexPath];
cell.myUILabel.text = @"my text";
[tableView reloadData];
}
}
的這裏的問題是cellForRowAtIndexPath
返回類型UITableViewCell
,不myCustomCellView
的對象。
任何人都可以告訴我如何訪問和更新didSelectRowAtIndexPath
方法內的單元格的屬性?
@Scratcha開始哎,如果這個答案對你有用,那麼請接受和upvote答案:) – 2013-04-26 04:51:16