UIScrollView - scroll location

I am trying to figure out how to figure out where scrollview will stop when the user executes a gesture wipe and scrollview goes into slowdown. I am trying to use delegate functions, but I cannot figure it out exactly. Please, help!

- (void) scrollViewDidScroll:(UIScrollView *)scrollView;
- (void) scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;
- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
+3
source share
5 answers

There is a variable for the current acceleration that is stored in the UIScrollView implementation, but using this as a solution is not possible because you cannot compile code for the device.

0
source

This thread is a bit outdated, but still suitable for finding this problem.

UIScrollViewDelegate , , ...

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset

targetContentOffset inout, , , scrollview .

+3

, UIScrollView - , .

+2

. , , . , , DidEndDecelerating, , ?

0

It should be simple math. The contentOffset property for scrollview is updated every time scrollViewDidScroll is called. You need to save the vector between two positions and the time to get at least the final deceleration deceleration position.

Please note that the user can stop braking at any time by clicking on the scroll, as indicated by Jaanus.

0
source

Source: https://habr.com/ru/post/1731774/


All Articles