I am using scrollViewDidScroll delegate in my application.
But, many times, even though I dint start scrolling, this delegate is getting invoked which is creating a lot of problem. I heard that even when contentSize for a particular scroll view is set then at that time also this delegate i.e., scrollViewDidScroll
will invoke.
What are the different scenarios in which this delegate gets invoked. What are the steps to control this?
Can I set any parameter to handle this?
Hi Guys its very old question, however, if you wanna know if the scrollDidScroll
was triggered manually(through finger) or its due to other event like didSelect
or setContentOffset
, use the UIScrollView.isTracking
property.
To prevent scrollDidScroll:
from firing automatically when the view is loaded and adjusted, I waited to add my UIScrollView
delegate
until after all the views load using viewDidLayoutSubviews
. It is working well for me.
- (void)viewDidLayoutSubviews {
// add table view delegate after the views have been laid out to prevent scrollViewDidScroll
// from firing automaticly when the view is adjusted on load, which makes the tab bar disappear
self.tableView.delegate = self;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With