简体   繁体   English

UIView下的UIButton不应该是可点击的

[英]UIButton under UIView should NOT be clickable

I have a view with some UIButtons on it. 我有一些UIButtons的视图。 I add another - semi transparent - view on top of all, displaying some information to the user (actually, it's kind of a selfmade modal-alert). 我添加了另一个 - 半透明 - 视图,向用户显示一些信息(实际上,它是一种自制的模态警报)。 But the buttons under the semi-transparent view still react to taps. 但是半透明视图下的按钮仍然会对水龙头做出反应。 They shouldn't, though. 但他们不应该这样做。

How can I prevent the buttons from reacting to taps? 如何防止按钮对水龙头做出反应?

Setting, 设置,

semiTransparentViewOnTopOfAll.userInteractionEnabled = YES;

should solve this problem. 应该解决这个问题。 But, still if the problem persists, try, 但是,如果问题仍然存在,请尝试,

semiTransparentViewOnTopOfAll.exclusiveTouch = YES; 

do like this 这样做

button.userInteractionEnabled=NO;

by getting all buttons from view 从视图中获取所有按钮

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM