How get latiude and longitude of point?
I am developing an iPhone Application in which i have provide Pin Annotation button on tool bar. When user click on button then pin will drop on center of map view. Now i want that use开发者_运维问答r move that pin and place at their desired place and i will get latitude and longitude of that point. So how i define all these event with my map view? How do that? I get this code for add annotation.
- (void)addPinAnnotation:(id)sender {
UICRouteAnnotation *pinAnnotation = [[[UICRouteAnnotation alloc] initWithCoordinate:[routeMapView centerCoordinate]
title:nil
annotationType:UICRouteAnnotationTypeWayPoint] autorelease];
[routeMapView addAnnotation:pinAnnotation];
}
How get latitude and longitude of that point?
Thanks in advance....
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
// Add annotation to map
MKCoordinateRegion reg;
CLLocationCoordinate2D location = newLocation.coordinate ;
reg.center = location;
MKCoordinateSpan span;
span.latitudeDelta = 1.5;
span.longitudeDelta = 1.5;
reg.span = span;
reg.center=newLocation.coordinate;
[self.mapView setRegion:reg animated:TRUE];
annotation = [[myAnnotation alloc] initWithCoordinate:newLocation.coordinate title:@"Click > to set or drag to move"];
[self.mapView addAnnotation:annotation];
[self.mapView selectAnnotation:annotation animated:YES];
[manager stopUpdatingLocation];
[loading stopAnimating];
}
精彩评论