uiview - 如何在 MonoTouch 中使 UIView 可点击?

标签 uiview xamarin.ios monotouch.dialog

我目前正在尝试创建一个简单的 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/

相关文章:

c# - Xamarin.Forms (iOS) - 如何更改 SearchBar "Cancel"按钮的文本?

ios - Storyboard : How to add outlets to a prototype UITableViewCell?

从列表中打开 View 的 Ios 默认图标

xamarin.ios - Monotouch.Dialog:是否有一种简单的方法可以使搜索栏在滚动时停留在 UITableView 的顶部?

ios - 出现覆盖时如何禁用主 UI?

ios - 使用 CATransform3DRotate 垂直而不是水平旋转 View 作为立方体?

objective-c - 开始/结束外观转换的不平衡调用

ios - MvvmCross Xamarin.iOS 绑定(bind) : How does MVVM cross know what property to bind against?

c# - MonoTouch.Dialog - 响应 DetailDisclosureButton 点击

ios - UIView 显示了 25%