简体   繁体   English

当用户与ios中的滑块交互时,滚动视图不应滚动

[英]Scroll view should not scroll when user interacts with slider in ios

我有一个启用分页功能的滚动视图,它是水平滚动的,因此当用户从第一页滚动时,它将使用户进入第二页,第二页具有一个滑块。当用户在该滑块上滑动(不触摸)时,它将自动滚动到第一页,因为它也可以水平滚动。除非用户不打算转到第一页,除非其触摸滑块用户最终都可以转到第一页。

I had the same kind of problem once but with another control. 我曾经遇到过同样的问题,但又有另一个问题。 Take a look ate this answer to see if it canhelp you : 看一下这个答案,看看是否可以帮助您:

iPhone - UIScrollView and UIDatePicker scrolling conflict : the one interfer with the second iPhone-UIScrollView和UIDatePicker滚动冲突:一个干扰第二个

Does the second view on the scrollView contains any other container like WebView or imageView etc. scrollView的第二个视图是否包含任何其他容器,例如WebView或imageView等。

If you are showing your data directly on the ScrollView (ie on second page).I recommend that to add a one more view on your scrollView on second view and render your data on that view the you wil be able to use the main ScrollView and the second view scroll separately. 如果您要直接在ScrollView上显示数据(即在第二页上)。我建议在第二个视图的scrollView上再添加一个视图,并在该视图上呈现数据,则可以使用主ScrollView和第二个视图分别滚动。

You could try adding actions for UIControlEventTouchDown , UIControlEventTouchUpInside and UIControlEventTouchUpOutside to your slider. 您可以尝试将UIControlEventTouchDownUIControlEventTouchUpInsideUIControlEventTouchUpOutside操作添加到滑块。 On touch down, do myScrollView.scrollEnabled = NO; myScrollView.scrollEnabled = NO;时,执行myScrollView.scrollEnabled = NO; and restore scrolling on touch up. 并恢复触摸时的滚动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM