开发者

How to Change the color of the text present in table view from its default black color in an iphone application?

开发者 https://www.devze.com 2023-01-20 09:50 出处:网络
How to Change the color of the tex开发者_开发知识库t present in table view from its default black color in an iphone application ? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtI

How to Change the color of the tex开发者_开发知识库t present in table view from its default black color in an iphone application ?


 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

 static NSString *CellIdentifier = @"Cell";

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
 if (cell == nil) 
 {
 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
 cell.textLabel.textColor = [UIColor yellowColor]; //Change the text color

 }

 // Configure the cell...

 return cell;
 }


Try this.

cell.textLabel.textColor=[UIColor blueColor];

You can also give RGB values like

cell.textLabel.textColor =  [UIColor colorWithRed:200/256.0 green:0/256.0 blue:67/256.0 alpha:1.0];

All the best.

0

精彩评论

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