0

Is it possible to let UITableview move up/down whole cell height just like date picker (not stop between the cell top and bottom)?

meteor
  • 25
  • 4

1 Answers1

0

The class UITableView is a subclass of UIScrollView.

This means that, if the object you specified as your table view's delegate also adopts the UIScrollViewDelegate protocol, that protocol's methods will be called on it whenever the relevant scroll events happen on the table view.

You can use that timing to "fix" the table view's scroll offset in just the right way to simulate the snap-to-row-bnoundary behaviour you're after.

Some examples:

  • scrollViewDidEndDragging(_:willDecelerate:): Tells the delegate when dragging ended in the scroll view.

  • scrollViewDidEndDecelerating(_:): Tells the delegate that the scroll view has ended decelerating the scrolling movement.

Which methods to implement, and what exactly to do in their implementations, will depend on what effect you want to achieve. Play around and see.

Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189