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.
A view that presents data using rows in a single column.
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.
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.
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]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With