ios - subview 如何识别父 View (iPhone)的设置属性?

标签 ios uiview uikit user-interaction uiresponder

场景是这样的,

我有一个 UIButton合二为一UIView .
所以UIView是父 View
UIButton是 subview 。
现在,

  • 如果我将父 View 的用户交互设置为 false,那么我可以单击UIButton ?
  • 如果我无法触摸 UIButton那为什么 UIButton不是
    可触摸的?

  • 你能解释一下如何UIButton会知道它的父 View 的用户交互是假的吗?

    谢谢,

    最佳答案

    类似问题,查看here

  • 不,你不能。父 View 上的 userInteractionEnabled 设置为 NO 将阻止所有 subview 。
  • 这是 Appel 关于“事件传递”的文档,查看 link
  • 查看房产self.superView.userInteractionEnabledhitTest:withEvent:方法或pointInside:withEvent:方法。
  • 关于ios - subview 如何识别父 View (iPhone)的设置属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14556171/

    相关文章:

    ios - 为什么隐藏状态栏会完全破坏我的简单动画?

    ios - 从 EDSunriseSet 获取夜间模式

    ios - 大 subview 以适应另一个小 subview

    ios - 使用 UIAlertController 排除某些 View 的调光

    iphone - PresentModalViewController 操作耗时

    ios - TableView 显示项目中的图像

    ios - 在不丢失约束的情况下调整 UITextView 的大小

    ios - 使用iOS 7的新屏幕快照方法,一个返回不带状态栏的UIImage,一个返回带有状态的UIView。如何模糊状态栏?

    objective-c - 在 Objective-C 中获取方法的返回类型的方法?

    ios - 从 UITableViewCell 获取 UITableView separatorColor?