Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the velocity unit in scrollViewWillEndDragging:withVelocity:targetContentOffset:?

The documentation states it's points (per second, I'm assuming)? However, the values I get for it are in the (.5, 3.5) range. The scroll view then travels several hundred points before coming to a halt. The actual initial velocity should be different by orders of magnitude.

like image 712
RS1 Avatar asked Mar 14 '12 17:03

RS1


2 Answers

It is points/millisecond. From UIScrollView.h:

// called on finger up if the user dragged. velocity is in points/millisecond. targetContentOffset may be changed to adjust where the scroll view comes to rest
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset NS_AVAILABLE_IOS(5_0);

This is from iOS 7 SDK, which seemed more plausible given the very low values they've been returning in velocity.

like image 195
junjie Avatar answered Sep 21 '22 17:09

junjie


From Docs

called on finger up if the user dragged. velocity is in points/millisecond. targetContentOffset may be changed to adjust where the scroll view comes to rest

like image 36
daihovey Avatar answered Sep 20 '22 17:09

daihovey