Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何提高uiwebview上的滚动速度_Iphone_Ios - Fatal编程技术网

Iphone 如何提高uiwebview上的滚动速度

Iphone 如何提高uiwebview上的滚动速度,iphone,ios,Iphone,Ios,我在UIWebview上使用了下面的代码来提高滚动速度, 与之前的滚动相比,它很好,但是我的客户不满意,他这样问 滚动仍然感觉僵硬 有提高滚动速度的选项吗?在UIScrollViewDelegate上有这些属性 CGPoint lastOffset; NSTimeInterval lastOffsetCapture; BOOL isScrollingFast; 然后将此代码用于scrollViewDidScroll: - (void) scrollViewDidScroll:(UIScroll

我在UIWebview上使用了下面的代码来提高滚动速度, 与之前的滚动相比,它很好,但是我的客户不满意,他这样问

滚动仍然感觉僵硬


有提高滚动速度的选项吗?

在UIScrollViewDelegate上有这些属性

CGPoint lastOffset;
NSTimeInterval lastOffsetCapture;
BOOL isScrollingFast;
然后将此代码用于scrollViewDidScroll:

- (void) scrollViewDidScroll:(UIScrollView *)scrollView {    
    CGPoint currentOffset = self.currentChannelTableView.contentOffset;
    NSTimeInterval currentTime = [NSDate timeIntervalSinceReferenceDate];

    NSTimeInterval timeDiff = currentTime - lastOffsetCapture;
    if(timeDiff > 0.1) {
        CGFloat distance = currentOffset.y - lastOffset.y;
        //The multiply by 10, / 1000 isn't really necessary.......
        CGFloat scrollSpeedNotAbs = (distance * 10) / 1000; //in pixels per millisecond

        CGFloat scrollSpeed = fabsf(scrollSpeedNotAbs);
        if (scrollSpeed > 0.5) {
            isScrollingFast = YES;
            NSLog(@"Fast");
        } else {
            isScrollingFast = NO;
            NSLog(@"Slow");
        }        

        lastOffset = currentOffset;
        lastOffsetCapture = currentTime;
    }
}
- (void) scrollViewDidScroll:(UIScrollView *)scrollView {    
    CGPoint currentOffset = self.currentChannelTableView.contentOffset;
    NSTimeInterval currentTime = [NSDate timeIntervalSinceReferenceDate];

    NSTimeInterval timeDiff = currentTime - lastOffsetCapture;
    if(timeDiff > 0.1) {
        CGFloat distance = currentOffset.y - lastOffset.y;
        //The multiply by 10, / 1000 isn't really necessary.......
        CGFloat scrollSpeedNotAbs = (distance * 10) / 1000; //in pixels per millisecond

        CGFloat scrollSpeed = fabsf(scrollSpeedNotAbs);
        if (scrollSpeed > 0.5) {
            isScrollingFast = YES;
            NSLog(@"Fast");
        } else {
            isScrollingFast = NO;
            NSLog(@"Slow");
        }        

        lastOffset = currentOffset;
        lastOffsetCapture = currentTime;
    }
}