我有一个MKMapView,它有许多注释。选择引脚显示标注并按下附件将一个新的视图控制器弹出到堆栈上。但是,当我从新的VC中按回时,标注仍处于打开状态。我如何关闭它?如何在MKMapView中关闭MKAnnotation的标注
我已经试过
if([[myMapView selectedAnnotations] count] > 0)
{
//deselect that annotation
[myMapView deselectAnnotation:[[myMapView selectedAnnotations] objectAtIndex:0] animated:NO];
}
但这不起作用。 selectedAnnotations在数组中只有一个条目,因此它会进入该语句,但标注未关闭。
我需要添加一些东西到我的MKAnnotation实现或我的MKPinAnnotationView?
我不知道他们是否已经改变了SDK,因为你回答了这个问题,但selectedAnnotations确实是注解而不是MKAnnotationView的实例。 – jowie 2011-08-22 09:31:35
jowie是对的(但我不确定2009年情况是什么时候回答)。我需要编写这样的代码才能使其工作:for(id selected Annotation in selectedAnnotations){_mapView deselectAnnotation:annotation animated:NO]; } – 2013-05-25 08:33:56