【问题标题】:Touch event problem of UIPopoverController and DetailViewController in iOSiOS中UIPopoverController和DetailViewController的触摸事件问题
【发布时间】:2011-05-14 19:32:42
【问题描述】:

我的 iPad 项目使用了默认的拆分视图模板,现在我来解释一下布局。

在纵向模式下,UIPopoverController 包含一个 UINavigationController,它有一个 UITableView。

对于 DetailViewController,它包含一个检测触摸事件的 UIImageView。

我在 UIPopoverController 的 UITableView 中实现了滑动删除方法。

但是,当我在 UITableView 中滑动删除一个项目时,底层 UIImageView 也会收到滑动触摸事件。

当 UIPopoverController 可见(活动)时,如何阻止底层 UIImageView 接收触摸事件?

谢谢。

【问题讨论】:

    标签: iphone ios ipad


    【解决方案1】:

    您可以通过为您的UIImageView 设置属性userInteractionEnabled 为NO 来禁用它。因此您的UIImageView 将被忽略并从事件队列中删除

    @property(nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled 
    

    所以如下使用

    myImageView.userInteractionEnabled  =  NO;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-16
      • 2015-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-12
      相关资源
      最近更新 更多