如何判断UIScrollView滑动方向
1个回答
展开全部
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
//Selected index's color changed.
static float newx = 0;
static float oldIx = 0;
newx= scrollView.contentOffset.x ;
if (newx != oldx ) {
//Left-YES,Right-NO
if (newx > oldx) {
self.scrollLeftOrRight = NO;
}else if(newIndex < oldIndex){
self.scrollLeftOrRight = YES;
}
oldx = newx;
}
}
//Selected index's color changed.
static float newx = 0;
static float oldIx = 0;
newx= scrollView.contentOffset.x ;
if (newx != oldx ) {
//Left-YES,Right-NO
if (newx > oldx) {
self.scrollLeftOrRight = NO;
}else if(newIndex < oldIndex){
self.scrollLeftOrRight = YES;
}
oldx = newx;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询