How do i inverse the contents of NSArray in Objective-C?
Assume that i have an array which holds these data
NSArray arrayObj = [[NSArray alloc]init];
arrayObj atindex 0 holds this: "1972"
arrayObj atindex 1 holds this: "2005"
arrayObj atindex 2 holds this: "2006"
arrayObj atindex 3 holds this: "2007"
Now i want to inverse the order of array like this:
arrayObj atindex 0 holds this: "2007"
arrayObj atindex 1 holds this: "2006"
arrayObj atindex 2 holds this: "2005"
arrayObj atindex 3 holds this: "1972"
How to achive this??
Thank You.
NSArray* reversed = [[originalArray reverseObjectEnumerator] allObjects];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With