I cannot change the text colors of a UITableViewCell using the UIAppearance mechanism.
Here is my commentary code showing what works for me and what doesn't:
UITableViewCell *cell = [UITableViewCell appearance]; cell.backgroundColor = [UIColor blueColor]; // working cell.textLabel.textColor = [UIColor whiteColor]; // NOT WORKING cell.detailTextLabel.textColor = [UIColor redColor]; // NOT WORKING UILabel *cellLabel = [UILabel appearanceWhenContainedIn:[UITableViewCell class], nil]; cellLabel.textColor = [UIColor whiteColor]; // working
As you can see, the second way works, but I cannot set different colors for plain text and long text.
Is there something I'm doing wrong?
PS Defining statics in Interface Builder will not work for me - I have themes that can be dynamically changed at runtime.
source share