问题
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: http://imgur.com/ffmk0jP
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?
回答1:
how about this ?
scrollToNearestSelectedRowAtScrollPosition:animated:
?tableview scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];
回答2:
you can use viewWillTransition function for that to stop that issue..
verride func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator){}
来源:https://stackoverflow.com/questions/42712493/swift-3-ios-tableview-scroll-by-cell