MapView注释indexPath?

| 有没有一种方法(或任何方法)可以在方法内部获取注释的“索引路径”:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation
我想做的就是根据注释在数组中获取一些东西。我想复制的方法之一是
- tableView:cellForRowAtIndexPath:
并使用\“ indexPath \”。 搜索了很多,但没有找到任何结果。或者,也许我只是在搜索方面很烂。任何参考将不胜感激。     
已邀请:
NSUInteger index = [mapView.annotations indexOfObject:annotation];
由于基础数组是可变数组,请注意
index
可以更改。这似乎是您可以获得的最接近的“ 4”类信息。     
要回答我自己的问题(这对我如何起作用): 我在自定义批注中创建了一个实例,并将数据传输到那里,然后在
- mapView:viewForAnnotation:
(我使用了自定义pinView)中导入并创建了CustomAnnotation的实例,并从那里获取了数据。
[customAnnotation setSomething: data];
- mapView:viewForAnnotation:
{
    pinView = [[[CustomPinView alloc] initWithAnnotation: annotation reuseIdentifier: PinIdentifier] autorelease];
}
- initWithAnnotation:reuseIdentifier:
{
    CustomAnnotation *customAnnotation = (CustomAnnotation *)annotation;

    [customAnnotation something];
}
对我来说矫kill过正,但可以完成工作。     

要回复问题请先登录注册