MapView注释indexPath?

Ang*_*elo 5 iphone annotations objective-c mkmapview ios

是否有方法(或任何方法)可以获取方法内注释的"索引路径":

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation
Run Code Online (Sandbox Code Playgroud)

我想要做的是根据注释在数组中获取内容.我认为我要复制的方法之一是- tableView:cellForRowAtIndexPath:使用"indexPath".

搜索了很多但没有找到任何结果.或者也许我只是在搜索时很糟糕.任何参考将不胜感激.

Ang*_*elo -1

回答我自己的问题(这对我来说是这样的):

\n\n

我在自定义注释中创建了一个实例,并将数据传输到那里,然后再传输到内部- mapView:viewForAnnotation:(我使用了自定义 pinView)导入并创建了 CustomAnnotation 的实例,并从那里获取了数据。

\n\n
[customAnnotation setSomething: data];
Run Code Online (Sandbox Code Playgroud)\n\n
- mapView:viewForAnnotation:\n{\n    pinView = [[[CustomPinView alloc] initWithAnnotation: annotation reuseIdentifier: PinIdentifier] autorelease];\n}
Run Code Online (Sandbox Code Playgroud)\n\n
- initWithAnnotation:reuseIdentifier:\n{\n\xc2\xa0   CustomAnnotation *customAnnotation = (CustomAnnotation *)annotation;\n\n    [customAnnotation something];\n}
Run Code Online (Sandbox Code Playgroud)\n\n

对我来说太过分了,但它完成了工作。

\n