dpstart dpstart - 1 year ago 66
Swift Question

Slowing down UIScrollView scrolling

I'm using a UIScrollView to programatically animate some content.

However, I need to slow down the scrolling of the view.

This is the code I am using for the scrolling:

self.scrollView.setContentOffset(CGPoint(x: 0, y: self.view.frame.height), animated: true)

I have tried to add
scrollView.decelerationRate = UIScrollViewDecelerationRateFast
but it didn't seem to be working.

Answer Source

Try the following code:

UIView.animate(withDuration: 1.5) { 
    self.scrollView.contentOffset = CGPoint(x: 0, y: self.view.frame.height)