iPhone iOS UILabel how to customize text color for UITableView detail text labels only?

18,031

You could trick around this by subclassing the cells in the detail view, then use

[[UILabel appearanceWhenContainedIn:[YOUR_UITableViewCell class], nil] 
 setTextColor:[UIColor other_colr]];
Share:
18,031
Alex Stone
Author by

Alex Stone

When people asked me what I wanted to do for work 10 years ago, I did not know too well, so I just said "Something to do with computers". As I look at the last 10 years, I see that I did quite a lot of work all kinds of computers. From fiddling with microcontrollers and assembler code to writing data processing scripts to physically assembling computer consoles. The big step forward came when I learned to think about software in a structured, object-oriented way, as this allowed me to make software do things that I want it to do. Right now I'm proficient in two high level programming languages - Objective-C and Java and have touched just about every framework available for iOS. I've also became a hacker/maker and have completed a number of projects involving software and hardware. Right now I'm in my early 30s and when I ask myself "What would I like to do in the next 10 years?", my answer is "something with the human brain". The seeds are already there - I've picked up an interest in biology, cognitive science and neuroscience, enough to converse with real people. I've done first-hand research into sleep and made discoveries. I've taken classes in synthetic biology, performing manipulations on the bacteria genome. I've learned a lot about the neurotransmitter systems of the human brain, as well as how a biological organism develops. It seems like there are a lot of similarities between the object-oriented concepts I use in the daily programming tasks and how biological organisms operate. This makes me hopeful that by the time I'm in my late 30s, I would be able to work and program some form of biological computer or just plain hack the human brain.

Updated on June 05, 2022

Comments

  • Alex Stone
    Alex Stone almost 2 years

    I'm working on an interface prototype and am using a storyboard to do so. Part of the prototype involves setting the detail UILabel for UITableView cells to a certain color. I would like to avoid having to manually recolor every label within a storyboard.

    I found that I can use:

    [[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil] 
     setTextColor:[UIColor cyanColor]];
    

    To change the appearance of labels within tableview cells. Is there a way to further refine this code to only apply to detail tableview labels? Currently it changes both textLabel and detailTextLabel of UITableViewCell.

    Thank you!