我目前正在尝试创建一个简单的 UIView,其中包含一些标签和图像。 如何将 UIView 设置为可点击?
我已经尝试重写 onTouchEnded
方法,但是当我将标签和图像作为 subview 添加到 View 中时,不再调用该方法。
最佳答案
but when I added the labels and the images as subviews to the view the method is not called anymore.
因为 UIImageView 和 UILabel 的 userInteractionEnabled
属性默认设置为 NO
。将其设置为 YES
(true),应该没问题。
关于uiview - 如何在 MonoTouch 中使 UIView 可点击?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12332704/