0

I am confused with scrollViewDidScroll scrollViewWillEndDragging. Do they work as async way?

I found that at a moment, both scrollViewDidScroll and scrollViewWillEndDragging are triggered and not finished.

scrollViewDidScroll stackTrack scrollViewWillEndDragging stackTrack

ps: NO BLOCK in my code

EDIT

I will use a property in scrollViewDidScroll, which will be updated at the end of scrollViewWillEndDragging. My question is whether scrollViewDidScroll and scrollViewWillEndDragging run as async way. If so I need use lock to prevent it.

Tepmnthar
  • 548
  • 3
  • 23

1 Answers1

0

scrollViewWillEndDragging

This UIScrollViewDelegate method will be called when user finishes scrolling the content within your UIScrollView.

scrollViewDidScroll

While this UIScrollViewDelegatemethod will be called when user scrolls the content within your UIScrollView.

Rajat
  • 10,977
  • 3
  • 38
  • 55
  • thank you, i have updated my question, hope that it will help you understand my issue... – Tepmnthar Nov 14 '16 at 06:16
  • @Tepmnthar you want to detect when user starts scrolling and when user ends scrolling ? – Rajat Nov 14 '16 at 06:17
  • I want to use new value set in scrollViewWillEndDragging when scrollview still scrolling (decelerating). – Tepmnthar Nov 14 '16 at 06:26
  • check this method - https://developer.apple.com/reference/uikit/uiscrollviewdelegate/1619386-scrollviewwillbegindecelerating – Rajat Nov 14 '16 at 06:45
  • Finally I found this [why-scrollViewDidScroll-triggeredl](http://stackoverflow.com/questions/9418311/setting-contentoffset-programmatically-triggers-scrollviewdidscroll). I have edited **contentOffset** in my `scrollViewWillEndDragging` then `scrollViewDidScroll` triggered. My mistake. Sorry for not giving enough information. Any way thank you very much. – Tepmnthar Nov 14 '16 at 07:17