I have an NSArray
with objects inside (CLLocation
). I can have 50, 100, 300 or more objects inside. In fact, this array is used while the user walking and can follow a direction. But the user can start at the middle of my NSArray
, you know what I mean ?
Well, I Have to loop all the time my array to know where my user is compare to the locations in my array.
My question is: Is it possible to use a thing like in Java with a "cursor" in a list, and simply call "Next object" to travel in my array instead of loop ?
Because I need that the user walk on all location of my array. Example:
- Count of my array: 100
- User start at location at index 34 (the nearest location found)
- The user must do 35, 36, 37... 100 AND 0,1,2,3 ... until 33.
Hope it's clear, I really don't know how to do this without using for loop...
Thank you for help and suggestions!
Regards, Lapinou.