Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What color is the text in the detail view of a UITableViewCellStyleValue1?

Tags:

ios

ipad

ios4

I've added a text field in one of the accessory views of my table view. The problem is that the color of the text is black, and the color in the detail views of the other cells around it are some kind of lightish blue. I want the text in the text field to have the same color and it's not [UIColor blueColor];

So does anyone know how I can get the color in my text field to have the same color as the cells around it.

like image 637
Christian Gossain Avatar asked Mar 25 '11 17:03

Christian Gossain


People also ask

What is UITableView in Swift?

A view that presents data using rows in a single column.

How can we use a reusable cell in UITableView?

For performance reasons, a table view's data source should generally reuse UITableViewCell objects when it assigns cells to rows in its tableView(_:cellForRowAt:) method. A table view maintains a queue or list of UITableViewCell objects that the data source has marked for reuse.

What is prototype cell?

A prototype cell acts a template for your cell's appearance. It includes the views you want to display and their arrangement within the content area of the cell. At runtime, the table's data source object creates actual cells from the prototypes and configures them with your app's data.


1 Answers

The most straightforward way is probably to read out the color from the detailTextLabel's textColor property. Or set the textColor on the detailTextLabel on all the other cells when you create them. That way they will all remain the same even if Apple changes the color (or introduces theming of some sort) in a future version of the OS.

On the 4.2 simulator, the color seems to be [UIColor colorWithRed:0.22 green:0.33 blue:0.53 alpha:1.0].

like image 56
Anomie Avatar answered Sep 28 '22 09:09

Anomie