简体   繁体   中英

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?

I think this should work:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM