Reputation: 12444
I am pretty much trying to do the following line with backwards iteration:
for (int i = 0; i < [thetableView numberOfRowsInSection:0]; i++) {
I know there is reverseObjectEnumerator
but I am not sure how to integrate that into an array like this. Can anyone help me out here? I have looked through many other answers to no avail.
Would this do it?
for (int i = [thetableView numberOfRowsInSection:0]-1; i > -1; i--) {
Upvotes: 0
Views: 435
Reputation: 2383
int numberOfRows = [theTableView numberOfRowsInSection:0] - 1;
for (int i = numberOfRows; i >= 0; i--)
{
}
Set the variable to the number of rows, minus 1 (to account for the 0 base).
Set the condition to test if i is greater than or equal to 0. If the above condition is true,
Instead of adding 1 on each iteration, decrease by 1.
Upvotes: 3