Eric
Eric

Reputation: 4061

UITableView from NSMutableArray iPhone

I have an array with objects 1-10 (let's say). I want the cell.textLabel.text = 1,3,5,7... and I want the cell.detailtextLabel.text = 2,4,6,8...

How do I get the detail text to alternate?

Or, is there a better way? Make two mutableArrays and combine them?

Upvotes: 0

Views: 109

Answers (1)

llullulluis
llullulluis

Reputation: 3492

I think this should work:

cell.textLabel.text = [yourlist objectAtIndex:(indexPath.row * 2)];
cell.detailtextLabel.text = [yourlist objectAtIndex:(indexPath.row * 2)+1];

Upvotes: 1

Related Questions