问题:UIScrollview 弹跳使父 UIScrollview 弹跳
我在全屏 UIScrollview(A) 中有一个全屏 UIScrollview(B)。
A 的内容大小 = 水平页数
B 的内容大小 = 垂直子页数
在 B 内部,我有一个小的 UIscrollview (C),其滚动方向与 B 相同...所以也垂直。
当 C 疯狂滚动时,当到达 contentSize 末尾时,它会产生硬弹跳效果。
问题是:它还会在 B 上产生弹跳效果!!!!有没有办法抑制父母和孩子之间的反弹效应的污染,而不抑制双方的反弹效应。
谢谢
I have a fullscreen UIScrollview(B) in a fullscreen UIScrollview(A).
A has a contentsize = number of page Horizontally
B has a contentsize = number of Subpage Vertically
Inside B , I have a small UIscrollview (C) that scroll in the same direction than B... So vertically too.
When C is wildly scrolling, it creates a hard bouncing effect when the end of the contentSize is arrived.
the problem : IT CREATES ALSO A BOUNCING EFFET ON B!!!! is there a way to suppress this contamination of the bounce effect between parents and childs without suppress the bounce effet of both.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
苹果文档警告不要类似的设计。来自文档:
由于您发现的原因,我会将此警告扩展到嵌套的 UIScrollViews。
您可以通过大致执行移动 Safari 浏览器的操作来将其从嵌套的 A/B/C UIScrollViews 中模拟出来。用户要么处于“网页选择”模式(您的 A&B 视图),要么处于“查看网页”模式(您的 C 视图)。 Safari 的自定义 WebView 控制器中的按钮允许用户从“查看网页”模式跳转到“网页选择”模式,该模式是一个 UIScrollView,其中包含当前活动的每个页面的缩略图。
因此,在您的情况下,这意味着将 C 从嵌套的 UIScrollViews 中拉出,向 C 视图控制器添加一个按钮来呈现 A&B 视图控制器,并且可能创建另一个控制器类将它们粘合在一起。
我还主张将 A 和 B 合并到一个 UIScrollView 中。
The Apple documentation warns against similar designs. From the docs:
I would extend this warning to nested UIScrollViews for the reasons you've discovered.
You can pull it off an analog of the nested A/B/C UIScrollViews by doing roughly what the mobile Safari browser does. The user is either in "web page select" mode (your A&B views) or in "view web page" mode (Your C view). A button in Safari's custom WebView controller allows the user to jump out of "view web page" mode to "web page select" mode, which is a UIScrollView with thumbnails of each of the pages currently active.
So, in your case, that would mean pulling C out of the nested UIScrollViews, adding a button to the C view controller that presents the A&B view controller, and maybe creating another controller class to glue it all together.
I'd also advocate combining A&B into a single UIScrollView.
根据 Apple iOS 滚动视图编程指南现在..
所以嵌套滚动视图是完全没问题的> iOS 3。为了回答你的问题,我将滚动视图 C 作为子视图添加到“容器”UIView - 在将该容器视图添加到滚动视图 B 之前。似乎阻止了弹跳将父滚动视图向下拉,尽管我确实必须漂亮地滑动努力并快速地使其在没有容器视图的情况下表现出您所描述的行为。
According to the Apple iOS Scroll View Programming Guide now..
So nesting scrollviews is perfectly fine > iOS 3. To answer your question, I added scrollview C as a subview to a "container" UIView - before adding that container view to scrollview B. Seems to stop the bounce pulling the parent scroll view down, although I did have to swipe pretty hard and fast to make it exhibit the behaviour you described without the container view.