如何“排外”处理多点触摸事件

    经常有网友问,如何避免同时处理多个多点触摸事件?实际上,在Apple的官方文档中已经提供了解决方案。

    Apple在UIView的multipleTouchEnabled属性的讨论中提到:如果你希望这个视图“排外”处理多点触摸事件,只需要把组的这一属性,属性的值是multipleTouchEnabled和exclusivetouch的值同时设为YES。

multipleTouchEnabled
A Boolean value that indicates whether the receiver handles multi-touch events.

@property(nonatomic, getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled
Discussion
When set to YES, the receiver receives all touches associated with a multi-touch sequence. When set to NO, the receiver receives only the first touch event in a multi-touch sequence. The default value of this property is NO.

Other views in the same window can still receive touch events when this property is NO. If you want this view to handle multi-touch events exclusively, set the values of both this property and the exclusiveTouch property to YES.

Availability
Available in iOS 2.0 and later.
See Also
  @property exclusiveTouch
Related Sample Code
aurioTouch2
Declared In
UIView.h



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值