I created and fulfilled UITableViewCell. I want to update textLabel.text at fifth row when I pressed UINavigationButton. How can I do this?
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;
The direct way is,
NSIndexPath *fifthRow = [NSIndexPath indexPathForRow:4 inSection:0];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:fifthRow];
cell.textLabel.text = @"the updated text";
But, the better way is to update the dataSource and reload the tableView or just the row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With