【问题标题】:How to Pass on User Events to Another View after processing it处理后如何将用户事件传递给另一个视图
【发布时间】:2011-10-13 23:05:12
【问题描述】:

假设我有一个 UITableview。

如果用户单击表格单元格,则该单元格被选中。

与我拥有 MKMapView 的方式相同。如果用户选择了一个注解,那么该注解就会被选中。

现在我想安排当我单击单元格的空白部分时发生的事情。

所以我添加了一个点击手势。

但是当我点击时,单元格的非空部分,如表​​格和其他东西,单元格和地图视图不会再次被选中。

只有手势选择器被调用。

在调用手势选择器后,我想将选项卡“传递”回表格单元格和 mkmapview。我该怎么做?

【问题讨论】:

    标签: objective-c xcode uitableview mkmapview uigesturerecognizer


    【解决方案1】:

    在子类的touchesEnded 方法中调用您的代码,然后在超类上调用touchesEnded,或者在特定视图对象上调用它:

    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        [self someMethod];
        [super touchesEnded:touches withEvent:event];
    }
    

    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        [self someMethod];
        [mapView touchesEnded:touches withEvent:event];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-26
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      相关资源
      最近更新 更多