[英]Can't disable bounce with UIScrollView and pagingEnabled=YES
I have UIViewController
that hold UIScrollView
inside it.我有
UIViewController
里面装有UIScrollView
。
The m_scrollView
is with pagingEnabled=YES;
m_scrollView
与pagingEnabled=YES;
On each "page" I have UIViewController that display article.在每个“页面”上,我都有 UIViewController 显示文章。
To prevent bouncing when the user swipe from page to page i used:为了防止用户在页面之间滑动时弹跳,我使用了:
m_scrollView.bounces=NO;
and even乃至
m_scrollView.alwaysBounceHorizonal=NO;
I notice the change was only to the last page that is not bounce.我注意到更改仅针对未反弹的最后一页。 But when swiping the other pages, they bounce.
但是当滑动其他页面时,它们会反弹。
EDIT: the optimal solution was make the first and last page bounce ( so the user will get repsond there is no more pages\paging) and the other pages without bouncing编辑:最佳解决方案是使第一页和最后一页弹跳(因此用户将得到repsond没有更多的页面\分页)和其他页面没有弹跳
the annoying with the bounce when swiping pages is the bounce effect is not equal and same.滑动页面时弹跳的烦人是弹跳效果不相等。 somtimes it bounce more, and somtimes less.
有时它会弹得更多,有时弹得更少。
I tought is somthing to do with the loading data in the pages, but I dont think it's the case, cause it happens also when all pages are loaded and no async operation of loading are happening in the background.我认为这与页面中的加载数据有关,但我不认为是这种情况,因为当所有页面都加载并且后台没有发生异步加载操作时也会发生这种情况。 Any ideas?
有任何想法吗?
EDIT 2: I guess the bounce property is about the edge of the UIScrollView, But when moving from page to page there is also bouncing.编辑 2:我猜弹跳属性大约是 UIScrollView 的边缘,但是当从一个页面移动到另一个页面时,也会出现弹跳。 Sometimes I can see a little of next-next page.
有时我可以看到一点下一页。 For example: swiping from page 2 to page 3, and in the animation of swiping I can see for 0.1 second page 4.
例如:从第 2 页刷到第 3 页,在 animation 的刷卡中我可以看到 0.1 秒第 4 页。
Also, the animation of swiping is not constant.另外,刷卡的animation也不是恒定的。 and it feel that each swipe acts little diffrent.
并且感觉每次滑动都没有什么不同。 Thanks in advance.
提前致谢。
just do this:这样做:
_scrollView = [[UIScrollView alloc]init];
_scrollView.pagingEnabled = YES;
_scrollView.bounces = NO; //Here
then, no bounce any more!然后,不再反弹!
If you set a delegate for your UIScrollView, the delegate will receive scrollViewWillBeginDecelerating:
when the user lifts their finger off the screen.如果你为你的 UIScrollView 设置了一个代理,当用户将手指从屏幕上移开时,该代理将收到
scrollViewWillBeginDecelerating:
You may then be able to take control using the UIScrollView's setContentOffset:animated:
method to scroll the nearest page into view, or set up your own animation using the animateWithDuration:animations:
method – I'm not sure whether your own animation will take precedence over the already-in-progress deceleration, though.然后,您可以使用 UIScrollView 的
setContentOffset:animated:
方法进行控制,将最近的页面滚动到视图中,或者使用animateWithDuration:animations:
方法设置您自己的 animation – 我不确定您自己的 animation 是否会优先不过,已经在进行中的减速。
You can also set the UIScrollView's decelerationRate
to UIScrollViewDecelerationRateFast
, which may make the scrolling more consistent in this situation.您还可以将 UIScrollView 的
decelerationRate
设置为UIScrollViewDecelerationRateFast
,这样可以使这种情况下的滚动更加一致。
set scrollbar's bounce property false/no....it will not bounce after that... try it hope yu will get your solution....将滚动条的反弹属性设置为假/否....之后它不会反弹...尝试一下希望您能得到您的解决方案....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.