문제

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!

도움이 되었습니까?

해결책

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

다른 팁

you have to make 2D array:

UITableViewCell *cell = [[cellsArray objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top