0
我有下面的代碼,當一個UI元素被點擊執行:iOS版 - viewForAnnotation回報,而不執行
- (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
立即返回而不執行,然後正確執行?!?!
謝謝!