Reputation: 751
How to change the colour of text of each row in tableview in iphone? Anyone know about it? Then Please give me the guidance.
Thanks in advance.
Upvotes: 0
Views: 76
Reputation:
Have your all row colours in an NSArray. Lets say myColorArray and it will contain all your UIColor objects for the rows.
And do cell.textLabel.textColor = [myColorArray objectAtIndex:indexPath.row];
in
tableView:CellForRowAtIndexPath:
function.
Upvotes: 0
Reputation: 12036
In
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Add:
cell.textLabel.textColor = [UIColor redColor];
Upvotes: 2
Reputation: 5310
Basically what you would need to do is the following in the tableView:CellForRowAtIndexPath:
method
cell.textLabel.textColor = yourColor;
If you want more info on using custom cells you can check out my blog Effective Mobility
Upvotes: 3