开发者

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

开发者 https://www.devze.com 2023-02-10 04:11 出处:网络
I have added some data in UITableView, and I want to change the color of the text displayed in the cells.

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 doi开发者_运维问答ng this, or any other way?


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


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.


The code according to hex number of color code

Use this code

If color code is: #4B4B4B so Red:75 Green:75 Blue:75

cell.textLabel.textColor = 
             [UIColor colorWithRed:75.0/255.0 green:75.0/255.0 blue:75.0/255.0 alpha:1];
0

精彩评论

暂无评论...
验证码 换一张
取 消