How can I call a method on scroll-events in a UIScrollView?

I have a UIScrollView object where I want to implement some effects that occur when the user scrolls. Is there a way to call a method in the view controller class every time the user triggers the scroll action or scrolls?

I also need the current scroll position. I'm pretty sure there is something useful. Perhaps I could ask 50 times a second for the current scrolling or whatever. Any idea?

0


a source to share


1 answer


Take a look at the protocol UIScrollViewDelegate

.

You can set the view controller as a delegate for the scroll view and implement some of the methods, for example:



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

      

+3


a source







All Articles