UITableView, force to snap to whole UITableViewCell at top of table

Posted by Adam Eberbach on Stack Overflow See other posts from Stack Overflow or by Adam Eberbach
Published on 2010-03-22T01:05:50Z Indexed on 2010/03/22 1:11 UTC
Read the original article Hit count: 405

Filed under:
|

I have a need to make a UITableView only display whole cells at the top of the cell, so when the table is moved or scrolled it should animate to make a whole cell visible at the top of the table if it has happened to stop with a cell partially off the top. This can be easily done using visibleCells and scrollToRowAtIndexPath methods of UITableView, BUT the cell should not always scroll down to move the partial cell into view - if the cell at top is more than 50% gone it should go completely with the next cell (i.e. index 1 in the array returned by visibleCells) moving to the top of the table.

I've tried a few things to make this happen but I don't think I am understanding the way frame and bounds work between a UITableView and its UITableViewCells. Any help?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch