Search code examples
iphoneuitableviewnsarray

how to add new elements in array at the top of the table view


i am displaying array of elements in a tableview.

Now i need to display some other new elements on table view.

For this i try by adding new elements to array which is datasource of table view and reloading the table.

Then It displaying the newly added elements but the problem is it is adding at last element of array so it displaying at the bottom of the table view.

But i need to display that new value at the top of the table view. How can i done this can any one please help me.

Thank u in advance.

(Let me add comment if any one does n't get my question).


Solution

  • Insert the new items at the top of your array using NSMutableArray insertObject: atIndex:.