Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I the change text color of the cells of a UITableView?

I have added some data in UITableView, and I want to change the color of the text displayed in the cells.

Is there a delegate method for doing this, or any other way?

like image 705
Chatar Veer Suthar Avatar asked Feb 14 '11 13:02

Chatar Veer Suthar


People also ask

How do I change the background color of a table in Swift?

Basic Swift Code for iOS Apps For changing the background color of the table view cell, you should change the contentView. backgroundColor property of the cell. Now run the project to see the effect.


2 Answers

NO need for Labels

You just need to code :

cell.textLabel.textColor = [UIColor redColor];

or if you want to change the detailTextLabel :

cell.detailTextLabel.textColor = [UIColor blueColor];

good luck

like image 56
shannoga Avatar answered Oct 21 '22 17:10

shannoga


You can add labels in the cell and set the color for these labels according to you .And also you can add more than one label and customize the cell.

simply use this line

cellLabel.textColor=[UIColor redColor]; //according to you.
like image 42
Ishu Avatar answered Oct 21 '22 18:10

Ishu