如何判断UIScrollViewjquery 判断滚动方向向

判断滑动方向UITableView
-(void)scrollViewWillBeginDragging:(UIScrollView*)scrollView{
lastContentOffset = scrollView.contentOffset.y;
-( void )scrollViewDidScroll:( UIScrollView *)scrollView {
if (scrollView.
contentOffset.y < lastContentOffset )
[ self.navigationController
setNavigationBarHidden : NO
animated : YES ];
if (scrollView. contentOffset.y >
lastContentOffset )
[ self.navigationController
setNavigationBarHidden : YES
animated : YES ];UIScrollerView滚动方向判断
我的图书馆
UIScrollerView滚动方向判断
PushListView.h@interface PushListView : UIView&UITableViewDelegate,UITableViewDataSource{&&& & CGFloat contentOffsetY; & & &&CGFloat oldContentOffsetY; & & & CGFloat newContentOffsetY;}...............................PushListView.m
//开始拖拽视图 - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { & & contentOffsetY = scrollView.contentOffset.y; } &// 滚动时调用此方法(手指离开屏幕后) - (void)scrollViewDidScroll:(UIScrollView *)scrollView { & & //NSLog(@"scrollView.contentOffset:%f, %f", scrollView.contentOffset.x, scrollView.contentOffset.y); & & newContentOffsetY = scrollView.contentOffset.y; && & & & if (newContentOffsetY & oldContentOffsetY && oldContentOffsetY & contentOffsetY) {& // 向上滚动 && & & & & & & & NSLog(@"up"); && & & & & & } else if (newContentOffsetY & oldContentOffsetY && oldContentOffsetY & contentOffsetY) { // 向下滚动 & & & & & & & NSLog(@"down"); & & } else { & & & & & & & & NSLog(@"dragging"); & & } && & & & if (scrollView.dragging) {& // 拖拽 && & & & & & & & NSLog(@"scrollView.dragging"); && & & & & & & & NSLog(@"contentOffsetY: %f", contentOffsetY); & & & & NSLog(@"newContentOffsetY: %f", scrollView.contentOffset.y); && & & & & & & & if ((scrollView.contentOffset.y - contentOffsetY) & 5.0f) {& // 向上拖拽 && & & & & & & & & & & & // 隐藏导航栏和选项栏 & & & & & & // [self layoutView]; & & & & & & [_viewController.navigationController setNavigationBarHidden:YES animated:YES]; & & & & & & //[_viewController.navigationController setToolbarHidden:!hidden animated:YES]; & & & & & & _viewController.tabBarController.tabBar.hidden = YES; && & & & & & & & & & } else if ((contentOffsetY - scrollView.contentOffset.y) & 5.0f) { & // 向下拖拽 && & & & & & & & & & // 显示导航栏和选项栏 & & & & & & //[self layoutView]; && & & & & & & & & & & & [_viewController.navigationController setNavigationBarHidden:NO animated:YES]; & & & & & & //[_viewController.navigationController setToolbarHidden:NO animated:YES]; & & & & & & _viewController.tabBarController.tabBar.hidden = NO; && & & & & & & & & & } else { && & & & & & & & & & } & & }} // 完成拖拽(滚动停止时调用此方法,手指离开屏幕前) - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { & & // NSLog(@"scrollViewDidEndDragging"); & & oldContentOffsetY = scrollView.contentOffset.y; }
TA的最新馆藏
喜欢该文的人也喜欢没有更多推荐了,
不良信息举报
举报内容:
UIScrollView如何判断是向右滚动还是向左滚动
举报原因:
原文地址:
原因补充:
最多只允许输入30个字
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(4647)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'UIScrollView判断滚动方向',
blogAbstract:'- (void) scrollViewDidScroll:(UIScrollView *)scrollView{&&& static float newY = 0;&& &&&& newY = scrollView.contentOffset.y;&&& if (newY != _oldY) {&&&&&&& if (newY & _oldY && (newY - _oldY) & 100) {&&&&&&&&&&& NSLog(@\"Down\");&&&&&&&&&&& _oldY = newY;&&&&&&& } else if (newY & _oldY && (_oldY - newY) & 100) {',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:2,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:true,
hostIntro:'',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}

我要回帖

更多关于 js 判断滚动条方向 的文章

 

随机推荐