Reputation: 2251
I use the following code to set the contentInset
for my tableView
.
self.scrollView.contentInset = UIEdgeInsetsMake(109, 0, 44, 0);
But this triggers the UIScrollView
delegate method scrollViewDidScroll:
.
Is this the expected behaviour? If so, is there any workaround to avoid this situation?
Thanks in advance.
Upvotes: 5
Views: 2256
Reputation: 3380
Just use a variable to check if you want to act when scrollViewDidScroll is triggered. And in scrollViewDidScroll check for this variable and apply your actions accordingly. Its the only solution worked for me. Set this variable true or false before you want to skip.
Upvotes: 0
Reputation: 2092
You can try removing the scroll views delegate before setting the content insets. Then reapply the delegate.
id scrollDelegate = scrollView.delegate;
scrollView.delegate = nil;
scrollView.contentInset = UIEdgeInsetsMake(109, 0, 44, 0);
scrollView.delegate = scrollDelegate;
Upvotes: 4