IPhone UIScrollView, slowdown scroll

How to add extra drag and drop to UIScrollView physics. It scrolls too fast for what I'm doing. (I don’t want to turn it off at all, I still like the effect of the rubber band when you get to the end or the beginning of the performance.) Is there a way to slow it down?

+4
source share
4 answers

Actually, after reading the Documentation, I found a UIScrollView property that slows down scrolling, so Apple makes this available to anyone looking for this:

scrollView.decelerationRate = UIScrollViewDecelerationRateFast; 

Despite the fact that he speaks quickly, it speeds up the slowdown, which actually slows down the scroll. That was exactly what I needed. And don't worry about patents. :)

+19
source

In fact, you can do a block animation with ScrollToRowAtIndexPath : ... with an animated set to NO . Thus, the animation of the animation block will animate the lapped variables manually using the selected time.

+3
source

How UICollectionView is a subclass of UIScrollView . You can use the scroll delegate method.

 - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { targetContentOffset->x = (targetContentOffset->x - scrollView.contentOffset.x) / 6 + scrollView.contentOffset.x; targetContentOffset->y = (targetContentOffset->y - scrollView.contentOffset.y) / 6 + scrollView.contentOffset.y; } 
+1
source

It is simply not possible now. Apple may one day extend the API to allow this, but until that day, you're stuck with the default speed.

The only other option is your own scroll implementation. This is not trivial if you want an entire beautiful varnish, such as the effect of a rubber band, and a way to scroll the lock horizontally or vertically. Not to mention the click to scroll.

In addition, Apple has a patent for some of these scrolling actions, so writing your own can even be dangerous. Source: Apple Touch Screen Patent .

A computing device comprising: a touch screen; one or more processors; Memory; and one or more programs in which one or more programs are stored in memory and configured to be executed by one or more processors, one or more programs, including: instructions for detecting one or more finger contacts with a touch screen display; instructions for applying one or more heuristics to one or more finger contacts to determine a command for a device; and instructions for processing the team; in which one or more heuristics include: vertical scrolling heuristics of the screen to determine that one or more finger contacts correspond to a one-dimensional screen scrolling command, and not a two-dimensional screen translation command based on the angle of the initial movement of the finger contact relative to the touch screen; heuristic of a two-dimensional sketch of a screen to determine that one or more finger contacts correspond to a two-dimensional translation command of the screen, and not a one-dimensional scrolling command on a vertical screen based on the angle of the initial movement of the finger contact with respect to the touch screen ; and heuristic of the next element to determine that one or more contacts of the finger correspond to the transition command from displaying the corresponding element in the element set to display the next element in the element set.

But of course I'm not a lawyer.

0
source

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


All Articles