简体   繁体   English

UIButton内的UIView

[英]UIView inside a UIButton

I have to add a button. 我必须添加一个按钮。 This should be glowing non stop. 这应该发光不停。 So I used an external library. 所以我使用了一个外部库。 By this I have to add the image to an UIImageView and then the imageview to the view. 这样,我必须将图像添加到UIImageView,然后将imageview添加到视图。 This is added to the button. 这已添加到按钮。 The glow is enabled by the startGlow: method which takes in a UIView. 通过使用UIView的startGlow:方法启用发光。 This forces me to add the UIView to the UIButton. 这迫使我将UIView添加到UIButton。 The problem comes in when I touch the button, it is not responsive inside which is filled with UIView. 当我触摸按钮时,问题就来了,它在UIView中没有响应。 The edges seems to work fine. 边缘似乎工作正常。 Any fix for this? 有什么解决办法吗? I want the button to be responsive for all the TouchInside event. 我希望按钮对所有TouchInside事件都具有响应性。 Thank you 谢谢

If you don't need to interact with a view you can turn off the interaction by setting the userInteractionEnabled property to NO. 如果不需要与视图交互,可以通过将userInteractionEnabled属性设置为NO来关闭交互。 You should then be able to interact with the view or UIButton below it. 然后,您应该能够与其下面的视图或UIButton进行交互。

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

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