dpstart
dpstart

Reputation: 1098

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.

Upvotes: 1

Views: 1171

Answers (1)

Sandeep Kumar
Sandeep Kumar

Reputation: 328

Try the following code:

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

Upvotes: 1

Related Questions