How do you change the textLabel when UITableViewCell is selected?
Posted
by Ike
on Stack Overflow
See other posts from Stack Overflow
or by Ike
Published on 2009-12-03T22:09:50Z
Indexed on
2010/04/20
4:23 UTC
Read the original article
Hit count: 300
I want to change the textLabel and detailTextLabel of a cell when it has been selected. I've tried the following, but no change occurs:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MyAppDelegate *appDelegate = (MyPhoneAppDelegate*)[[UIApplication sharedApplication] delegate];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.detailTextLabel.text = @"xxxxx";
cell.textLabel.text = @"zzzzz";
[tableView reloadData];
}
© Stack Overflow or respective owner