I have customized uitableViewcell in which each cell show four data which are related to each other(ie object name,details, new price and old price). Data for each label Come from four different array.It is working fine. But now i want to sort table according to ascending price list or alphabetical order of object name on a button click. Problem is if I sort only the corresponding label change in each cell, others label remain same. i want to reorder each cell not individual label as four label are related to each other. Should I use NSDictionary for this or something else.Please guide me how to do it. Thanks.
I have customized uitableViewcell in which each cell show four data which are related
Share
This does not really have anything to do with the Table. You need to think data structures.
If I were you I will define a class with 4 attributes
Say
Or something like that.
And now you can have ONE array with objects being instances of the above class.
Now you can sort the array by instance.name or instance.newPrice and relations will stay intact.
You then will just reload the tableView.