mor*_*des 10 cocoa-touch objective-c uiscrollview uislider
我在UIScrollview中有一个(垂直)UISlider.我希望能够更改滑块的值,并且无需抬起手指,向左或向右滚动滚动视图.
期望的行为:
触摸垂直UISlider内部,然后向左或向右拖动手指使滚动视图滚动
实际行为:
触摸垂直UISlider内部,然后向左或向右拖动手指在UIScrollview中不会移动.在UISlider 外部触摸,然后拖动将按预期滚动滚动视图
UIView有一个名为exclusiveTouch的属性,好像它可能与我的问题有关.我尝试将它设置为NO,没有运气.
那么,如何设置我的UISliders以便它们下面的滚动视图能够响应源自UISliders内部的触摸?
你有没有尝试过子类化UIScrollView和实现- (BOOL)touchesShouldCancelInContentView:(UIView *)view?根据Apple文档:
// called before scrolling begins if touches have already been delivered to a subview of the scroll view. if it returns NO the touches will continue to be delivered to the subview and scrolling will not occur
// not called if canCancelContentTouches is NO. default returns YES if view isn't a UIControl
Run Code Online (Sandbox Code Playgroud)
如果你只是回来,NO如果view是你的UISlider,这可能会做你想要的,假设你的UIScrollView水平滚动.如果这不起作用,你可能将不得不做定制的触摸操作(即压倒一切的touchesBegan:withEvent:,touchesChanged:withEvent:对等),您都UIScrollView和你UISlider.
| 归档时间: |
|
| 查看次数: |
3092 次 |
| 最近记录: |