0

I have an array of dictionaries with each a bunch of keys with values. I display this data in a tableview. I want to add a segmented control on top which will sort the data. One of the keyvalue's is the date in a stringformat which should sort descending, and the other is a doublevalue which should also sort descending. I thought up way too complicated solutions, like checking each value which the last and building some sort of frankstein's ladder.

I hope someone can point me in a better direction.

1
  • If you can get the date as a NSDate then you can just use NSSortDescriptor to sort them. Commented Oct 4, 2011 at 8:06

1 Answer 1

1

here you go

NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey:@"theDateKey" ascending:NO];
[searchTermsArray sortUsingDescriptors:[NSArray arrayWithObject:descriptor]];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.