【问题标题】:Reducing the scrolling sensitivity of Coverflow from TapkuLibrary从 TapkuLibrary 降低 Coverflow 的滚动灵敏度
【发布时间】:2012-07-30 16:42:51
【问题描述】:

我需要降低每个封面之间的滚动速度。有没有人想出一个好的解决方案?

我试图降低速度、每英里或固定英里,但没有奏效:(

来自“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] 刚刚发现编辑这个方法实际上并没有改变任何速度,它只是改变了封面的表现。

找到解决方案,回答。

【问题讨论】:

    标签: ios xcode coverflow tapku


    【解决方案1】:

    使用 decelerationRate 属性

    [self setDecelerationRate:0.9];
    

    coverflow 的动画效果在这个下还是很好用的。

    【讨论】:

    • 嗨,Orange,我正在尝试做同样的事情...您在哪里添加上述代码?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-13
    • 2014-04-14
    • 1970-01-01
    • 2015-01-26
    • 2021-02-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多