0

In my application I need to first pin annotation when ever I click the map and know to longitude and latitude of this point and after this both longitude and latitude I want to print on only one label, tell me how can I do this?

I tried following code, But no help.

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation 
  { 
    static NSString *identifier = @"MyLocation";
    if ([annotation isKindOfClass:[PlaceMark class]]) {

    MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [myMapView dequeueReusableAnnotationViewWithIdentifier:identifier];
    if (annotationView == nil) {
        annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
    } else {
        annotationView.annotation = annotation;
    }

    annotationView.enabled = YES;
    annotationView.canShowCallout = YES;

    return annotationView;
  }

  return nil; 
}
rptwsthi
  • 10,094
  • 10
  • 68
  • 109
adevani11
  • 415
  • 2
  • 5
  • 7
  • http://stackoverflow.com/questions/4806628/is-there-any-way-to-get-the-lat-long-of-mkmapview-of-touch-position-iphone-sdk – rptwsthi Feb 13 '13 at 07:34

1 Answers1

1

From this you can get the lat and long of annotation

for getting the latitude use this

[[[view annotation] coordinate].latitude

And longitude like this

 [[[view annotation] coordinate]. longitude
SachinVsSachin
  • 6,401
  • 3
  • 33
  • 39