如何检测仅在iOS中向下滚动的UITableView?
现在我可以检测到如何检测仅在iOS中向下滚动的UITableView?,uitableview,ios7,uiscrollview,Uitableview,Ios7,Uiscrollview,现在我可以检测到UITableView使用以下代码上下滚动 然而,我只想在向下滚动时触发事件。不包括上滚动 在-(void)ScrollViewDiEndDraging:(UIScrollView*)scrollView将减速:(BOOL)使用这些代码减速 NSInteger currentOffset = scrollView.contentOffset.y; NSInteger maximumOffset = scrollView.contentSize.height - scrol
UITableView
使用以下代码上下滚动
然而,我只想在向下滚动时触发事件。不包括上滚动
在-(void)ScrollViewDiEndDraging:(UIScrollView*)scrollView将减速:(BOOL)使用这些代码减速
NSInteger currentOffset = scrollView.contentOffset.y;
NSInteger maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;
if (maximumOffset - currentOffset <= 20.0) {
// [self methodThatAddsDataAndReloadsTableView];
NSInteger currentOffset=scrollView.contentOffset.y;
NSInteger maximumOffset=scrollView.contentSize.height-scrollView.frame.size.height;
如果(maximumOffset-currentOffset,则可以在拖动结束时将当前contentOffset
与目标contentOffset
进行比较。或者选中滚动
速度符号:
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint *)targetContentOffset {
NSLog(@"%@", scrollView.contentOffset.y > targetContentOffset->y ? @"top" : @"bottom");
NSLog(@"%@", velocity.y > 0 ? @"bottom" : @"top");
}