views:

155

answers:

1

I've got an UIScrollView object where I want to implement some effects happening when the user is scrolling. Is there a way to invoke a method on my view controller class every time the user starts a scroll action or is scrolling?

What I need is also the current scrolling position. I am almost sure that there is something useful available. Maybe I could ask 50 times per second for the current scrolling offset or something. Any idea?

+3  A: 

Take a look at the UIScrollViewDelegate protocol.

You can set your view controller as the delegate for the scroll view and implement some of the methods there, like:

– scrollViewDidScroll:
– scrollViewWillBeginDragging:
– scrollViewDidEndDragging:willDecelerate:
– scrollViewShouldScrollToTop:
– scrollViewDidScrollToTop:
– scrollViewWillBeginDecelerating:
– scrollViewDidEndDecelerating:
pgb