Would like to execute some code in a loop, but I want to pause it while a uiscrollview is scrolling.
I've created a BOOL named isScrolling that is set to "YES" in the scrollViewDidScroll method and is set to "NO" in the scrollViewDidEndDecelerating method.
I'd like to put the loop in the scrollViewDidEndDecelerating method, but have it paused when isScrolling == YES and then restart it when isScrolling == NO.
I am looping through an array, so I'd like the loop to pick up where it left off in the array.
For example, here's a simple loop that continually counts higher by increments of 1 that I placed in the viewDidAppear method:
for (int i = 1; i > 0; i++) {
NSLog(@"i = %d", i);
if (isScrolling == YES) {
NSLog(@"break");
break;
}
}
But, all scrolling is disabled while this loop is running for some reason so I can't cancel it.
How can I do this?
Thanks!