I’ m trying to iterate NSDictionary via the for in loop. But I want it to begin iteration from the end of this collection to its beginning. How can I implement this reversion?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Mmm… the problem is that NSDictionary are unordered by nature.
So, a possible solution is make an NSArray with the keys, reverse that array with “reverseObjectEnumerator” and then make a loop over the array and use the keys on dictionary.
Something like this:
The log is: