开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜