Sort/Enumerate an NSArray from somewhere in the middle?
Posted
by
Kenny Winker
on Stack Overflow
See other posts from Stack Overflow
or by Kenny Winker
Published on 2011-02-02T23:05:55Z
Indexed on
2011/02/02
23:26 UTC
Read the original article
Hit count: 227
I have an NSArray, with objects ordered like so:
- a
- b
- c
- d
- e
- f
I would like to enumerate through this array in this order:
- c
- d
- e
- f
- a
- b
i.e. starting at some point that is not the beginning, but hitting all the items.
I imagine this is a matter of sorting first and then enumerating the array, but I'm not sure if that's the best technique... or, frankly, how to sort the array like this.
Edit
Adding details: These will be relatively small arrays, varying from 3 to 10 objects. No concurrent access. I'd like to permanently alter the sort order of the array each time I do this operation.
© Stack Overflow or respective owner