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