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
戻り、その後正しく実行されるのはなぜですか?!?!
ありがとう!