I have UIScrollView with multiple UIVIew subviews. I would like to update the data that is displayed by each UIView when they appear in the visible portion of the UIScrollView.
What is the callback that gets triggered? I tried viewWillAppear, but it does not seem to get called.
Thanks. :)
A slight refinement. I wanted to know the amount of the view that was displayed in the scrollview:
Above answers are correct if your scrollview is not in the zoomed in state. In case if your scrollview can zoom above calculation won't work as you need to consider zoom too
here is the code
Swift 3 solution
You have to do the calculation yourself. Implement
scrollViewDidScroll:
in your scroll view delegate and calculate manually which views are visible (e.g. by checking ifCGRectIntersectsRect(scrollView.bounds, subview.frame)
returns true.