【问题标题】:How do i impelement touch End on uislider above the scroll view: iphone我如何在滚动视图上方的 uislider 上强制触摸 End:iphone
【发布时间】:2012-12-04 12:32:15
【问题描述】:

在我的应用中,我在 scrollView 上有一个 UISlider,

当用户从滑块上移开手指时,我需要将滑块移动到下一个 ciel/flor/round 值,

我实现了 Touch 委托方法,begin 和 Cancel,但是这些在滑块上不起作用(可能是由于 UIScroll 视图)。

触摸 uiscroll 视图不工作

怎么办?

【问题讨论】:

    标签: iphone objective-c uiscrollview uislider uitouch


    【解决方案1】:

    考虑到您的情况,我建议使用 UITapGestureRecognizer。 首先在 init 上设置 TapGestureRecognizer。

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
    [scrollView addGestureRecognizer:tap];
    

    然后从以下获取触摸:

      - (void)tapRecognizer:(UITapGestureRecognizer *)gesture
      { 
        CGPoint touchPoint=[gesture locationInView:scrollView];
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多