Is there a way to make UITableViews scroll cell to cell? That is, the top of the Table View is always the top of a UITableViewCell.
I tried the pageation flag, but t
This works well if you have sections and rows with static heights.
func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) {
// Adjust target offset so that cells are snapped to top
let cellHeight: CGFloat = 44
let headerHeight: CGFloat = 30
let section = (indexPathsForVisibleRows?.first?.section ?? 0) + 1
targetContentOffset.memory.y -= (targetContentOffset.memory.y % cellHeight) - (CGFloat(sectionIndex) * headerHeight)
}