Minkle Garg
Minkle Garg

Reputation: 751

Table view property in iphone

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

Answers (3)

user745098
user745098

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

Alex Terente
Alex Terente

Reputation: 12036

In

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

Add:

  cell.textLabel.textColor = [UIColor redColor];

Upvotes: 2

arclight
arclight

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

Related Questions