I have a custom subclass of UITableViewCell
. I am customizing the labels contained within the cell by setting some attributes of UILabel
's appearance proxy, as follows:
[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil].textColor = [UIColor blackColor];
[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil].highlightedTextColor = [UIColor redColor];
When I select the cell in the UI, the labels' colors change as expected and the code performs a push segue to the next view controller. However, when I pop this new view controller and go back to the screen with the custom UITableViewCell
s, the highlighted text color remains even though I am deselecting the cell in the code as follows:
- (void)viewDidAppear:(BOOL)animated
{
if ([self.tableView indexPathForSelectedRow]) {
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}
[super viewDidAppear:animated];
}
Is this a bug in iOS 7 or am I doing something wrong?