In the last tutorial, we looked at the sortedArrayUsingComparator method which allows you to run a comparison on objects in an array and rearrange the objects in the array. In this tutorial we will look at a simple method which can be used to reverse the order of the contents of an array. Just be aware that this tutorial is quite brief as the code is relatively simple to use… it’s just a single line if you already have an NSArray to use.
Lets say you have 5 NSStrings which are a,b,c,d,e. When we iterate through these they will come out in the order of a,b,c,d,e. What if we want to show this information in a table view, but in reverse order? i.e., e,d,c,b,a. We do this with the reverseObjectEnumerator method of NSArray. [Read more…]