我用MKMapView。在地图上我显示了可点击的AnnotationViews。单击AnnotationView后,我将MyController推送到NavigationController。在MyController中,我单击back按钮,之后我的前一个控制器显示(做pop控制器)。当我在我的didSelectAnnotationView回调中单击AnnotationVIew时,previousController不会被拉升。为什么会这样?
发布于 2011-11-11 10:45:57
这是因为当我单击注释时,它选择了注释,而当我再次单击该注释时,它没有调用回调didSelectAnnotationView,因为该注释已经被选中。
发布于 2011-11-11 10:26:35
检查是否在MKMapViewDelegate文件中添加了.h,并在.m文件中设置了委托。
mapView.delegate = self;但是,如果它不能工作,那么检查是否正确地编写了didSelectAnnotationView。
发布于 2015-12-23 23:00:39
Swift:
由Apple文档(按Cmd +单击类名):
// Select or deselect a given annotation. Asks the delegate for the corresponding annotation view if necessary.
public func selectAnnotation(annotation: MKAnnotation, animated: Bool)
public func deselectAnnotation(annotation: MKAnnotation?, animated: Bool)
public var selectedAnnotations: [MKAnnotation]因此,在对所选注释调用执行所有操作()之后,:
self.yourMapView.deselectAnnotation(yourAnnotation, animated: true)https://stackoverflow.com/questions/8092569
复制相似问题