1

I would like to add an animation when UIScrollView stops? How should I implement this? By using a timer and checking the decelerating value? Or I thought in 4.0 blocks are recommended.

Bartosz Ciechanowski
  • 10,293
  • 5
  • 45
  • 60
TiansHUo
  • 8,509
  • 7
  • 45
  • 57

3 Answers3

5

Use the UIScrollViewDelegate's scrollViewDidEndDecelerating: method. There's also scrollViewWillBeginDecelerating: to inform you that the scrollview is now slowing down.

DarkDust
  • 90,870
  • 19
  • 190
  • 224
  • Thanks a lot!! I also found this link useful:http://stackoverflow.com/questions/1969256/uiscroll-view-delegate-not-calling-scrollviewdidendscrollinganimation/4909621#4909621 – TiansHUo Mar 10 '11 at 04:16
1

Two things to remember here. First of all, set the delegate for the UIScrollView. Then implement your desired behavior in one or both of these delegate methods

-scrollViewDidEndScrollingAnimation:
-scrollViewDidEndDecelerating:

The difference between those two is explained in this nice answer.

Community
  • 1
  • 1
Bartosz Ciechanowski
  • 10,293
  • 5
  • 45
  • 60