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?
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;
}