Ios 正在调用DidSelect注释
我在地图视图中添加了一个点击手势识别器。我的地图视图有注释,当我点击注释时,只调用Ios 正在调用DidSelect注释,ios,objective-c,mkmapview,uitapgesturerecognizer,Ios,Objective C,Mkmapview,Uitapgesturerecognizer,我在地图视图中添加了一个点击手势识别器。我的地图视图有注释,当我点击注释时,只调用dismisscolectionview。未调用DidSelectAnnotation方法。当我点击一个注释时,如何停止tap手势方法(dismisscollection)调用?任何帮助都将不胜感激 self.m_mapView = [[MKMapView alloc] init]; self.m_mapView.frame = CGRectMake(0, 0, 320, 568); self.m_
dismisscolectionview
。未调用DidSelectAnnotation方法。当我点击一个注释时,如何停止tap手势方法(dismisscollection)调用?任何帮助都将不胜感激
self.m_mapView = [[MKMapView alloc] init];
self.m_mapView.frame = CGRectMake(0, 0, 320, 568);
self.m_mapView.delegate = self;
// MapHeight = self.m_mapView.frameHeight;
m_locationManager = [[CLLocationManager alloc] init];
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
[m_locationManager requestWhenInUseAuthorization];
[m_locationManager requestAlwaysAuthorization];
}
self.m_mapView.mapType = MKMapTypeStandard;
[self.m_mapView setUserTrackingMode:MKUserTrackingModeFollow];
[self.m_bgImageView addSubview:self.m_mapView];
m_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
m_locationManager.delegate = self;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissCollectionView)];
tapGesture.numberOfTouchesRequired = 1;
tapGesture.cancelsTouchesInView = NO;
[self.m_mapView addGestureRecognizer:tapGesture];
如果您希望两个动作都发生:设置手势识别器的委托并实现,以返回识别器和地图视图内部使用的任何动作的
YES
如果希望dismissCollectionView
和mapView:didSelectAnnotationView:
相互排斥:实现并检查触摸位置是否位于MKAnnotationView
或其子视图中。仅当位置位于所有注释视图之外时才返回YES