iOS 之 ExclusiveTouch

作者: Counting_S | 来源:发表于2016-12-29 11:32 被阅读1007次

今天偶尔看到了一个之前没注意过的UIView的属性exclusiveTouch,在这里记录一下。

文档中对这个属性的解释:

A Boolean value that indicates whether the receiver handles touch events exclusively.
Setting this property to YES causes the receiver to block the delivery of touch events to other views in the same window. The default value of this property is NO.

这个属性主要是解决多个控件同时响应事件的问题,将exclusiveTouch设置为YES的话可以阻止同一个window中其他控件与他响应,默认为NO
举个例子:页面中有按钮ButtonA 和 ButtonB,点击ButtonA会push该页面,点击ButtonB则会pop该页面,如果同时点击这个按钮的话页面就会连续出现pop和push的效果。如果设置了exclusiveTouchYES的话则可以避免发生这种事情。


可以使用 appearance 在APPDelegate中对UIView进行统一的设置。

[[UIView appearance] setExclusiveTouch:YES];

相关文章

  • iOS 之 ExclusiveTouch

    今天偶尔看到了一个之前没注意过的UIView的属性exclusiveTouch,在这里记录一下。 文档中对这个属性...

  • iOS 之 ExclusiveTouch属性

    exclusiveTouch属性: 默认是false,如果设置为true,则当前UIView会独占整个Touch事...

  • ExclusiveTouch iOS 8.0+

    ExclusiveTouch的作用是:可以达到同一界面上多个控件接受事件时的排他性,从而避免bug。也就是说避免在...

  • iOS 视图exclusiveTouch属性

    ExclusiveTouch的作用是:可以达到同一界面上多个控件接受事件时的排他性,从而避免bug。也就是说避免在...

  • ExclusiveTouch

    Exclusive 独有的 顾名思义: 独有的触摸事件,不允许其他的触摸事件打扰.也就是说避免在一个界面上同时点击...

  • ExclusiveTouch

    ExclusiveTouch的作用是:可以达到同一界面上多个控件接受事件时的排他性,从而避免bug。也就是说避免在...

  • ExclusiveTouch

    ExclusiveTouch的作用是:可以达到同一界面上多个控件接受事件时的排他性,从而避免bug。也就是说避免在...

  • ExclusiveTouch

    Setting this property to true causes the receiver to bloc...

  • ExclusiveTouch

    ExclusiveTouch 的作用是设置一个button或者其他能接受接收点击事件的控件, 让其在点击时,其他按...

  • iOS UIView用户事件响应(exclusiveTouch,

    www.cnblogs.com/wfwenchao/articles/3831507.html

网友评论

    本文标题:iOS 之 ExclusiveTouch

    本文链接:https://www.haomeiwen.com/subject/jyguvttx.html