Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - having selected cell move to top of uitableview

I looked for this problem and I don't believe I could find an answer. I have a tableview of custom cells that when clicked, the selected cell pushes a new cell with information. I was wondering if anyone had an idea of how to push the selected cell to the top of the uitableview, or make it fill up the entire tableview.

My uitableview only takes up half of the screen, and I wish for when the cell is selected that it only take up that half of the screen, and the user is still able to scroll the cell (if that makes sense)?

Any suggestions would be appreciated, it was somewhat difficult to describe what I am looking for, so if anyone needs clarification please do not hesitate to ask me.

like image 833
Alex Muller Avatar asked Mar 18 '11 14:03

Alex Muller


1 Answers

in cellForRowAtIndexPath, you need to place this in after you have created your cell

    [tableView scrollToRowAtIndexPath:selectedCellIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];

This did the trick for me with the custom height of the cells as well.

like image 179
Alex Muller Avatar answered Oct 13 '22 12:10

Alex Muller