I have a simple issue with UITableViewCell
.
What I want is to change the text color of a selected cell.
In my cellForRowAtIndexPath
method, I set:<
Got the solution by setting color in if (cell == nil) check
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
cell.textLabel.textColor = [UIColor whiteColor];
}
and
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView cellForRowAtIndexPath:indexPath].textLabel.textColor = [UIColor orangeColor];
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView cellForRowAtIndexPath:indexPath].textLabel.textColor = [UIColor whiteColor];
}
Thanks