【问题标题】:why are touches (set) are passed instead of a touch in touchesBegan?为什么在 touchesBegan 中传递的是触摸(设置)而不是触摸?
【发布时间】:2012-07-06 06:36:08
【问题描述】:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

为什么“touches”不只是“touch”被传递给 touchesBegan/Moved/Ended?

它们的含义是什么?

【问题讨论】:

    标签: iphone ios uiview touch


    【解决方案1】:

    这是因为用户可能会(快速)多次点击,在这种情况下,您将收到一组多个 NSTouch 对象。

    双击滚动(或图像)视图时的缩放效果就是一个演示。

    【讨论】:

      【解决方案2】:

      因为您可以接收多个触摸,但默认情况下它们是禁用的。为了接收多个触摸事件,您必须将相应视图实例的 multipleTouchEnabled 属性设置为 YES 并用 2 个或更多手指进行触摸。

      【讨论】:

        猜你喜欢
        • 2015-12-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多