ducklol
ducklol

Reputation: 15

swift 3 ios tableview scroll by cell

I created a tableview and it works normally as intended. However, I would like to change the scrolling such a way where the user can only scroll one cell at a time so that, there is never a time where the cell is cut in half..

This is an example: https://i.sstatic.net/LIYGN.jpg

So basically i do not want the default scrolling.. i would like it to be scrolled one cell at a time to constantly remain with the view of the original state..

Is there a way?

Upvotes: 1

Views: 1727

Answers (2)

Kay Weng
Kay Weng

Reputation: 73

how about this ?

  1. scrollToNearestSelectedRowAtScrollPosition:animated:?

  2. tableview scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];

Upvotes: 1

Sagar Bhut
Sagar Bhut

Reputation: 657

you can use viewWillTransition function for that to stop that issue..

verride func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator){}

Upvotes: 0

Related Questions