Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MapView annotation indexPath?

Is there a method (or any way) you can get the "index path" of the annotation inside the method:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation

What I want to do is get something inside an array according to the annotation. One of the methods I think that I want to copy is - tableView:cellForRowAtIndexPath: and use the "indexPath".

Searched a lot but not found any result. Or maybe I'm just bad at searching. Any reference will be greatly appreciated.

like image 452
Angelo Avatar asked Oct 25 '22 10:10

Angelo


1 Answers

NSUInteger index = [mapView.annotations indexOfObject:annotation];

Since the underlying array is a mutable one, note that the index can change. This seems to be the closest indexPath like information you can get.

like image 176
Deepak Danduprolu Avatar answered Nov 03 '22 01:11

Deepak Danduprolu