【问题标题】:How child view will identifie set property of parent view (iPhone)?子视图如何识别父视图(iPhone)的设置属性?
【发布时间】:2013-01-28 05:51:13
【问题描述】:

场景是这样的,

我有一个UIButton 和一个UIView。 所以UIView 是父视图 UIButton 是子视图。
现在,

  1. 如果我将父视图的用户交互设置为 false,那么我可以单击 UIButton?
  2. 如果我不能触摸UIButton 那么为什么UIButton 不是 可触摸?


你能解释一下UIButton 是如何知道它的父视图的用户交互是错误的吗?

谢谢,

【问题讨论】:

    标签: ios uiview uikit user-interaction uiresponder


    【解决方案1】:

    类似问题,查看here

    1. 不,你不能。父视图上的 userInteractionEnabled 设置为 NO 将阻止所有子视图。

    2. 这是来自 Appel 关于“事件传递”的文档,请查看 link

    3. 检查hitTest:withEvent:方法或pointInside:withEvent:方法中的属性self.superView.userInteractionEnabled

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多