- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == 《这里换成你的UICollocView子类》) {
//禁止右划
static float newx = 0;
static float oldx = 0;
newx= scrollView.contentOffset.x ;
if (newx < oldx) {
self.collectionView.scrollEnabled = NO;
self.collectionView.scrollEnabled = YES;
}
oldx = newx;
}
}
iOS使用UICollectionView只允许向左方向滑动,不允许向右方向滑动。
最新推荐文章于 2022-07-20 16:08:07 发布