Iam developing an iPad application, It has a tableview with custom cells.
Each cell is an object which represents the properties of the class in 3 columns.
I want to sort the data based on the columns. How can I achieve it using objective c?
Iam developing an iPad application, It has a tableview with custom cells. Each cell
Share
You can use a NSSortDescriptor to do this job.
Prepare the array that needs sorting
Create an array with NSSortDescriptors, in this example I use 1. For the DescriptorKey, take a property from the Cell on which you would like the sorting to be based upon.
Then instantiate a new array and call the sortedArrayUsingDescriptors instance method from NSArray, on your initial array, returning a sorted array with the same objects.
Hope this helps!