Question

Sorry for maybe stupid question, I am a very beginner. In some test code for iOS I see:

UITableViewCell *cell = cellsArray[indexPath.section][indexPath.row];

How can I spell out right part of this statement? Thanks for help!

Était-ce utile?

La solution

This is an exact equivalent of:

[[cellsArray objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];

cellsArray is an array of arrays, a 2-dimensional array. its count is number of sections in table view. every array represents a section and contains cells for this section. so you can access each cell by its row

Autres conseils

you have to make 2D array:

UITableViewCell *cell = [[cellsArray objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top