为了向上和向下滚动,我需要调用两个方法,我使用了下面的方法。我正在使用滚动视图委托方法,UICollection
因为它是子视图。这是UIScrollView
我编写的代码,但滚动并不容易移动,结果有时也不准确,有人可以建议吗?
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
CGPoint mScrollPosition = [scrollView.panGestureRecognizer velocityInView:mCollectionView];
if (mScrollPosition.y > 0.0f){
NSLog(@"going down");
//Action One
mYearHeaderTitle--;
[self.mCollectionView reloadData];
}
else if (mScrollPosition.y < 0.0f){
NSLog(@"going up");
//Action two
mYearHeaderTitle++;
[self.mCollectionView reloadData];
}
}