Vol*_*da2 6 iphone objective-c uitableview ios
我创建并实现了UITableViewCell.当我按下UINavigationButton时,我想在第五行更新textLabel.text.我怎样才能做到这一点?
UITableViewCell *cell;
cell = [tableView_ dequeueReusableCellWithIdentifier:@"any-cell"];
if(cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"any-cell"] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
cell.textLabel.text = leftString;
Run Code Online (Sandbox Code Playgroud)
Emp*_*ack 15
直接的方式是,
NSIndexPath *fifthRow = [NSIndexPath indexPathForRow:4 inSection:0];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:fifthRow];
cell.textLabel.text = @"the updated text";
Run Code Online (Sandbox Code Playgroud)
但是,更好的方法是更新dataSource并重新加载tableView或只是行.
| 归档时间: |
|
| 查看次数: |
6983 次 |
| 最近记录: |