【问题标题】:exclusive Touch does not work on a UIView and several image view as subview on UIView独家 Touch 不适用于 UIView 和几个图像视图作为 UIView 上的子视图
【发布时间】:2011-01-10 05:40:16
【问题描述】:

我有一个 UIView 和几个图像视图作为 UIView 上的子视图视图。我需要实现这种情况,“当在视图上触摸图像视图时,不会传递其他图像视图触摸事件”。

我使用UIView独有的touch属性,但是当我触摸其中一个子视图时,我同时触摸了,其他子视图的触摸事件也传递了触摸事件。 我还为所有视图设置了多点触控禁用。

【问题讨论】:

    标签: cocoa-touch multi-touch uitouch


    【解决方案1】:
    for (UITouch *touch in touches)
    {
        currentTouch=touch;
    
        if (CGRectContainsPoint([self.view frame], [touch locationInView:self.image1view]))
        {
            Give desired action here….
            [self transformSpinnerwithTouches:touch];
        }
        else
            if (GRectContainsPoint([self.view frame], [touch locationInView:self.imageview2]))
            {
                Give desired action here as well….
                [self dispatchTouchEvent:[touch view]WithTouch:touch];
            }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-28
      • 2019-04-06
      • 1970-01-01
      相关资源
      最近更新 更多