0

Friends

How to sort Plist data for Last inserted element display first in UItableView cell.

Currently My Plist data Displayed ascending order but i want to display plist data like last inserted element Display First of the table row(index 0).

please Help...Thank You

Nitin Gohel
  • 49,482
  • 17
  • 105
  • 144

1 Answers1

0

Well you can either reverse the data, or a better way to do it imo, you can just reference it differently.

//cellForRowAtIndexPath..
cell.textLabel.text = [arrayContainingData objectAtIndex:[aryContainingData count]-indexPath.row];

That way the first cell will contain the last item in the array, and the last cell will contain the first item. The other way would be to reverse the array (assuming you're using an array to begin with) as seen in this thread: How can I reverse a NSArray in Objective-C?

Community
  • 1
  • 1
Patrick T Nelson
  • 1,234
  • 12
  • 21
  • thak you for Reply patrick i implements reverce but issue is that for example i add data in plist like 23 then 4 then 56 so table view display data 56,23,4 but my query is that the data must be display in tableview like 56,4,23 ... – Nitin Gohel Mar 22 '12 at 14:09