0

When I scroll past the top cell (going up) in my UITableView, I release my finger and the UITableView returns back to it's original position with a nice bouncing animation. Is there any way to change the speed with which it scrolls back into the original position?

What I want to do is the following, if you pull the table down further then some 'x' threshold value of contentOffset, I want the table view to bounce back into original position faster than default.

Greg
  • 227
  • 1
  • 2
  • 9

1 Answers1

2

UIScrollView has a decelerationRate property that you can use. There is also a constant that you can set it to: UIScrollViewDecelerationRateFast

Wain
  • 118,658
  • 15
  • 128
  • 151
  • Doesn't seem to have any effect. I'm adding this: self.tableView.decelerationRate = UIScrollViewDecelerationRateFast; to my viewDidLoad of my tableviewcontroller. – Greg Jun 17 '13 at 18:31
  • Not sure when the default is set. But I thought you were going to set it as part of `scrollViewWillEndDragging...` – Wain Jun 17 '13 at 19:02
  • Unfortunately, it doesn't have any noticeable effect there either. – Greg Jun 17 '13 at 19:48
  • Have you tried any different values for the rate? Debugged to check the value is set and retained. – Wain Jun 17 '13 at 21:03
  • According to this answer you can't change the value to anything but defined constants. http://stackoverflow.com/a/8711525/233700 May be I can achieve the same thing by manipulating the contentOffset property? – Greg Jun 18 '13 at 00:13
  • You should be able to run an animation to a specified content offset with a specified duration, yes. – Wain Jun 18 '13 at 07:25