Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS:MKMapView中的WEPopoverController_Ios_Mkmapview_Hittest - Fatal编程技术网

iOS:MKMapView中的WEPopoverController

iOS:MKMapView中的WEPopoverController,ios,mkmapview,hittest,Ios,Mkmapview,Hittest,因为在mapview中的给定位置有多个元素要显示,所以在选择给定的MKPinAnnotationView时,我希望在MKMapView中显示WEPopoverController 到目前为止,以tableview的形式呈现内容效果良好。我已经对MKPinAnnotationView进行了子类化,当单击AnnotationView时,我调用我的自定义表示方法 - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnota

因为在mapview中的给定位置有多个元素要显示,所以在选择给定的MKPinAnnotationView时,我希望在MKMapView中显示WEPopoverController

到目前为止,以tableview的形式呈现内容效果良好。我已经对MKPinAnnotationView进行了子类化,当单击AnnotationView时,我调用我的自定义表示方法

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {

      [view openCustomPopoverInFrame:self.view.frame];

      [mapView deselectAnnotation:view.annotation animated:NO];

      if (_lastAnnotationView != view) {

           [_lastAnnotationView closeCustomPopover];

           _lastAnnotationView = view;
      }
}

- (void) openCustomPopoverInFrame:(CGRect) frame {

      CGRect fromFrame = self.frame; //Pin Annotation View Frame

      WEPopoverContentViewController *contentViewController = [[WEPopoverContentViewController alloc] initWithStyle:UITableViewStylePlain];
      contentViewController.delegate = self;

      WEPopoverController *viewController = [[WEPopoverController alloc] initWithContentViewController:contentViewController];
      //[viewController setPassthroughViews:[NSArray arrayWithObjects:contentViewController.view, contentViewController.tableView, nil]];

      viewController.delegate = self;

      //set the displayed content
      ....

      _myPopoverController = [viewController retain];

      [viewController presentPopoverFromRect:fromFrame inView:self.superview permittedArrowDirections:UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown animated:YES];

      [contentViewController release];
      [viewController release];
}
在tableview单元格中选择按钮也可以找到并得到预期的响应(方法被调用,popovercontroller保持在视图层次结构的顶部)

我的问题是,当我单击WEPopoverController内容(中间的一个表视图单元格,没有按钮),点击事件会传递到地图视图,因此隐藏了popover控制器。我能做些什么来防止传递的tap事件

我尝试了几种解决方案,例如设置passthroughview,并在WETouchableView中操作hitTest:withEvent:method,并始终返回nil,但这对我也没有任何帮助

最好的 Nic

编辑

我现在在dept中调试了WETouchableView中的hitTest:withEvent:method,它似乎总是返回UITableViewCellContentView的实例,我认为到目前为止应该是正确的

编辑

因此,更清楚一点,我想显示一个popover控制器,当它被点击时,它应该像通常的注释行为一样消失,也不应该调用底层视图。它应该位于视图的顶部,tap事件应该被表视图捕获并调用特定的方法(tableView:DidSelectRowatineXpath:)


我也看过这个解决方案,但它似乎对我不起作用,底层视图(即地图视图)被调用。

好的,对我起作用的是添加一个带有透明背景色的UIButton作为表视图单元格的第一个子视图。单元格上的所有点击事件现在都会被UIButton捕获。顺便说一句,所有刷卡事件都会被表视图捕获,所以至少这样可以正常工作

老实说,这不是一个很好的解决方案,但对我来说很有效。我真的很感激任何进一步的建议

最好的 Nic