iOS tableView上滑和下滑
作者:
夏天爱大树 | 来源:发表于
2017-06-22 11:15 被阅读342次//记录拖动时候的offset
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
self.contentOffset = scrollView.contentOffset.y;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat newOffsetY = scrollView.contentOffset.y;
if (newOffsetY > self.oldOffset && self.oldOffset > self.contentOffset){//上滑
//写上滑代码
}else if(newOffsetY < self.oldOffset && self.oldOffset < self.contentOffset){//下滑
//写下滑代码
}
self.oldOffset = scrollView.contentOffset.y;
}
//记录滑动结束时候的offset
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
self.oldOffset = scrollView.contentOffset.y;
}
本文标题:iOS tableView上滑和下滑
本文链接:https://www.haomeiwen.com/subject/ujaxcxtx.html
网友评论