UIScrollView趋向于“快照".回到先前的位置 [英] UIScrollView tends to "snap" back to a previous position

查看:44
本文介绍了UIScrollView趋向于“快照".回到先前的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是UIScrollerView,但我发现滚动时它倾向于捕捉"到先前的位置.

I'm using a UIScrollerView and I found that it tends to "snap" back to a previous position when I scroll it.

如果UItableView的滚动条停留在用户松开手指的位置,我想模拟这种行为.

I would like to simulate the behavior if the UItableView's scroller, that stays in the position where the user released his finger.

设置的属性:

[scroller setCanCancelContentTouches:NO];
scroller.clipsToBounds = YES;   
[scroller setScrollEnabled:YES];
scroller.userInteractionEnabled = YES;
scroller.alwaysBounceHorizontal = YES;
scroller.alwaysBounceVertical= NO;
scroller.showsVerticalScrollIndicator = NO;
scroller.scrollsToTop = NO;
scroller.bounces = NO;
scroller.pagingEnabled = NO;

推荐答案

出现回弹的可能原因有几个.

There a few possible reasons for the snap back.

一个可能是您已将pagesagingEnabled设置为YES,这意味着当用户放开手指时,它将对齐到最近的页面边界.

One could be that you have pagingEnabled set to YES which means that when the user lets go their finger, it will snap to the closest page boundary.

另一个是您对contentSize的设置不正确.如果您实际上可以滚动到顶部和底部并将其留在此处而不会弹开,那么这不是问题.

Another is that you have the contentSize set incorrectly. This is not the problem if you can actually scroll to the top and bottom and leave it there without it bouncing away.

这篇关于UIScrollView趋向于“快照".回到先前的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆