简体   繁体   English

如果在另一个视图下方,则禁用按钮交互

[英]Disable button interaction if below another view

I'd like to disable a button interaction if it is below another view. 如果按钮交互作用位于另一个视图下面,我想禁用它。

On this example, my UIButton is the green frame. 在此示例中,我的UIButton是绿色框。 I can tap on it and it will call the right selector (with control event "UIControlEventTouchUpInside"). 我可以点击它,它将调用右边的选择器(带有控制事件“ UIControlEventTouchUpInside”)。 But this call also work if I tap on the red frame which is above the green button, and I don't want that... 但是,如果我点击绿色按钮上方的红色框,那么此呼叫也可以工作,但我不希望这样...

屏幕截图示例

Any help to disable the interaction where the button isn't visible? 是否有任何帮助在按钮不可见的情况下禁用交互?

通过设置固定:

theUpperView.userInteractionEnabled = YES;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在其他视图中禁用按钮 - Disable button in another view 从xcode中的另一个视图控制器禁用按钮 - disable button from another view controller in xcode 两个不同的按钮对同一个视图控制器执行转场,但希望通过一个按钮禁用转场的用户交互 - Two different buttons performing segue to same view controller but want to disable user interaction for segue through one button 如何在另一个视图下方创建可点击按钮? (IOS) - How to create a clickable button when it is below another view? (iOS) 禁用根视图交互并一次启用子视图交互 - Disable Root view interaction and Enable subview interaction at a time 隐藏视图时如何禁用 UISlider 交互? - How to disable UISlider interaction when view is hidden? 输入为空白时禁用按钮交互 - Disable button interaction when input is blank 如何在页面视图中禁用用户滑动,但仍启用与页面视图中子视图的交互。 前按钮 - How to disable user swiping in page view but still enable interaction with the subviews in the page view. e.x. button 使用快速开关从另一个视图控制器禁用按钮 - Disable Button from another view controller with a switch with swift 禁用透明视图上的交互,而不会影响其子视图和按钮 - Disable interaction on transparent view without affecting its subviews and buttons
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM