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.
精彩评论