Reducing the scrolling sensitivity of Coverflow from TapkuLibrary

720 Views Asked by At

I have a need to reduce the scrolling speed between each cover. Have anyone comes up with a good solution for this?

I tried to reduce velocity, per, or fixed mi, but not working :(

The actual code from "TKCoverflowView.m"

#pragma mark UIScrollView Delegate
- (void) scrollViewDidScroll:(UIScrollView *)scrollView{
    velocity = abs(pos - scrollView.contentOffset.x);
    pos = scrollView.contentOffset.x;
    movingRight = self.contentOffset.x - origin > 0 ? YES : NO;
    origin = self.contentOffset.x;

    CGFloat num = numberOfCovers;
    CGFloat per = scrollView.contentOffset.x / (self.contentSize.width - currentSize.width);
    CGFloat ind = num * per;
    CGFloat mi = ind / (numberOfCovers/2);
    mi = 1 - mi;
    mi = mi / 2;
    int index = (int)(ind+mi);
    index = MIN(MAX(0,index),numberOfCovers-1); 

    if(index == currentIndex) return;

    currentIndex = index;
    [self newrange];

    if(velocity < 180 || currentIndex < 15 || currentIndex > (numberOfCovers - 16))
        [self animateToIndex:index animated:YES];
}

[edit] Just found out that editing this method don't actually change any speed, its only to make changes to the covers' presentation.

found the solution, answered.

1

There are 1 best solutions below

1
On

use the decelerationRate attribute

[self setDecelerationRate:0.9];

the animation effect of the coverflow still works very well with this.