大家好,我有一个关于 iPhone 的 mapKit 的密集问题。
我正在使用 MapKit 框架,我想要做的基本上是单击一个图钉,重新加载它,然后在再次添加后显示它的 callOut。
这是我试图开始工作的代码..
-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{
NSLog(@"count of selected Annotations: %d",[mapView selectedAnnotations].count);
MKAnnotation* pin = view.annotation;
[mapView deselectAnnotation:pin animated:FALSE];
[mapView removeAnnotation:pin];
[mapView addAnnotation:pin];
[self.mapView selectAnnotation:pin animated:TRUE];
一些观察:如果我注释掉 removeAnnotations 和 addAnnotation 行,我会进入一个无限循环,因为当我 selectAnnotation:pin 时,回调(这是这个方法)被调用......否则,它不是,但那是什么? 为什么不是
[self.mapView selectAnnotation:pin animated:TRUE];
被叫?
我已经阅读了太多,并且花了太多时间试图弄清楚对我的代码进行解释和修复比链接更有帮助。
提前致谢。~飞度