Tableview row scroll up on touch

Hello,

Is there a good soul willing to throw in some logic??

I’d want the rows in my tableview to place themselves at the center of the screen when touched.

I’m sperimentating with talbeview:scrollToY to do this, but I can’t quite figure out some math logic to feed the method a proper Y value. It should be some sort of calculation involving obviously the row.y touched and the content width of the screen, but I am circling around the solution without getting a decent result. Any idea…?

Thanks a lot!!

Seems like I found a way if anyone is interested and/or has better ideas:

if row.index \> 4 then  -- when touching the top rows tableview doesn't need to be scrolled....    tableView:scrollToY({y = (display.contentWidth / 2) - (rowHeight \* row.index), time = 100}) end

Don’t how I got to it but seems to be working in my case.

The tableview gets scrolled down until the interested row gets to the center of the screen.  You might place this conditional statement in the proper part of the code where you start interacting with a row.

Cheers!

Seems like I found a way if anyone is interested and/or has better ideas:

if row.index \> 4 then  -- when touching the top rows tableview doesn't need to be scrolled....    tableView:scrollToY({y = (display.contentWidth / 2) - (rowHeight \* row.index), time = 100}) end

Don’t how I got to it but seems to be working in my case.

The tableview gets scrolled down until the interested row gets to the center of the screen.  You might place this conditional statement in the proper part of the code where you start interacting with a row.

Cheers!