1

For my little project, I need you help. I already created a functioning table view. Now I want that the rows goes from bottom to top and not like usually from top to bottom. How do I do that?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • What do you mean exactly? In what way will your table view be different? What's wrong with a normal table view? Just scroll it to the bottom and add rows to the top. – rmaddy May 25 '15 at 14:16

3 Answers3

9

First you rotate your UITableView 180 degrees upside down, and then rotate your individual cells also upside down.

Take a look: UITableView anchor rows to bottom

Community
  • 1
  • 1
Simon Degn
  • 901
  • 1
  • 12
  • 40
  • Why? There's no reason for this. A normal table will work just fine. – rmaddy May 25 '15 at 14:17
  • 4
    Yes, a "normal" table is all you need, but if you want the cells to start at the bottom and "grow" up instead of the default top->bottom, then you need this small hack. I assume that is what you are interested in @rmaddy? – Simon Degn May 25 '15 at 14:21
  • I'm saying there is no need to transform the tableview. Just add rows to the top instead of the bottom. Until the OP clarifies their goal, I see no reason to suggest flipping the tableview and its cells. – rmaddy May 25 '15 at 14:23
  • 3
    "Now I want that the rows goes from bottom to top and not like usually from top to bottom." - that's OP's goal. To do that you have to transform the tableview.. I don't understand what "Just add rows to the top instead of the bottom." means? – Simon Degn May 25 '15 at 14:27
  • What does "rows goes from bottom to top" mean? That's what the OP needs to clarify. – rmaddy May 25 '15 at 14:28
  • 3
    hmm I don't see how it's not clarified? Normally the rows in a tableview goes from the top to the bottom - OP wants it from the bottom to the top :-) – Simon Degn May 25 '15 at 14:35
0

If you can target iOS 6+, this answer suggests using UICollectionView to lay out rows in reverse order: https://stackoverflow.com/a/23895000/144088.

Community
  • 1
  • 1
Crashalot
  • 33,605
  • 61
  • 269
  • 439
0

The most simple solution, you can use array.reversed() to show the last object of the array at the top of tableview

Gulfam Khan
  • 1,010
  • 12
  • 23