当点击 UI 元素时,我执行以下代码:
- (IBAction)setPoint
{
UserAnnotationView *pinview = (UserAnnotationView*)[self.map viewForAnnotation:currentAnnotation];
NSLog(@"droping it: %@", pinview);
NSLog(@"stop! hammer time!");
}
我的viewForAnnotation
样子是这样的:
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>) annotation
{
NSLog(@"here !!!");
...
...
}
所以,我希望控制台中的输出是:
here !!!
droping it: <some object representation>
stop! hammer time!
但相反,我有这个:
2012-12-07 18:03:58.506 MyApp[16523:707] droping it: (null)
2012-12-07 18:03:58.507 MyApp[16523:707] stop! hammer time!
2012-12-07 18:03:58.607 MyApp[16523:707] here!!!
怎么会viewForAnnotation
立即返回而不执行,然后正确执行?!?!
谢谢!