Search code examples
objective-ciosuiscrollviewibaction

Adding IBActions to UIScrollView


Hey, I was wondering if it would be possible to add IBActions to a UIScrollView? So when the user has scrolled to the next image an IBAction is done?

Would this be possible?


Solution

  • You would have to implement the UIScrollViewDelegate protocol and implement the -scrollViewDidScroll: method. In that method, you could use UIScrollView's contentOffset property to determine the current scroll position, and from there figure out what image it has scrolled to.