0

I am working with Here Maps offline maps. I had added four MapMarkers (annotations) . Now i want to get the NMAGeoCoordinates of the Map marker using the didSelectObjects:(NSArray *)objects method. This method returns the values, but it does not return the coordinates of the MapMarker.. Please guide me how to get the coordinates of the marker on selecting it. Thanks in advance.

-(void)mapView:(NMAMapView *)mapView didSelectObjects:(NSArray *)objects
{  
NSArray * arr=[[NSArray alloc]initWithArray:objects.lastObject];
NSLog(@"%@",arr);
}
Burhanuddin Sunelwala
  • 5,318
  • 3
  • 25
  • 51
Mohanraj
  • 587
  • 4
  • 21
  • What kind of `objects` are returned? It's returning a array of array? – Larme Jan 06 '16 at 10:51
  • It returns array with object of NMAMapmarker class and contains various attributes but there is no location coordiantes in it. I want to know the coordinates of the selected marker – Mohanraj Jan 06 '16 at 11:58
  • When you cast the Object inside didSelectObjects listner into NMAMapmarker, what is the value in coordinates ? – Jithin Krishnan Jan 08 '16 at 14:37
  • Thanks .. I found the solution... – Mohanraj Jan 09 '16 at 06:17
  • -(void)mapView:(NMAMapView *)mapView didSelectObjects:(NSArray *)objects { [self getlocation]; NMAMapMarker * marker=objects.lastObject; NSLog(@"%@",marker.location); _DestinationCoordinate=marker.location; [self CalculateRoute]; } – Mohanraj Jan 09 '16 at 06:17

1 Answers1

1
-(void)mapView:(NMAMapView *)mapView didSelectObjects:(NSArray *)objects {  

    NMAMapMarker *mapMarker = objects.firstObject;
    NSLog(@"coordinates: %@",mapMarker.coordinates);
}
Burhanuddin Sunelwala
  • 5,318
  • 3
  • 25
  • 51
  • one more thing i have NMA mapview and its delegate methods in a seperate viewcontroller and load it inside the viewcontroller in which map is required. Map markers are added but when i try to select the markers mapView didSelectObjects: method is not called. Help me @Burhanuddin Sunelwala – Mohanraj Feb 10 '16 at 12:00
  • @Mohanraj did you set the delegate to the viewcontroller? `mapView.delegate = self;` – Burhanuddin Sunelwala Feb 10 '16 at 12:53
  • how to use this in swift?? – Patel Jigar Jul 29 '16 at 11:25
  • @BurhanuddinSunelwala NMAMapMarker *mapMarker = objects.firstObject; from mapMarker how to get title name – Lalit kumar May 11 '17 at 11:10
  • Please check my question http://stackoverflow.com/questions/43848113/tap-on-particular-marker-how-to-get-title-name – Lalit kumar May 11 '17 at 11:11