I'd like to add annotation manually (when user touch in to the particular place in map view) and to get the details of that location (latitude,longitude,address)..
Asked
Active
Viewed 92 times
0
-
Duplicate of http://stackoverflow.com/questions/3959994/how-to-add-a-push-pin-to-a-mkmapviewios-when-touching/3960754#3960754 – ipraba Oct 28 '15 at 05:52
-
@iPrabu - how to get the location details and how to change the annotation position .. – Barani Oct 28 '15 at 06:16
1 Answers
0
as @iPrabu directed to similar post, with very good and correct answer for your problem... for second part i.e. to get details about that location..you can do something like this
-(void)getAddressFromCurruntLocation:(CLLocation *)location{
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error)
{
if(placemarks && placemarks.count > 0)
{
CLPlacemark *placemark= [placemarks objectAtIndex:0];
NSString *address = [NSString stringWithFormat:@"%@ %@",[placemark country],[placemark administrativeArea]];
// you may also get locality,sublocality,subadministrativeare etc
NSLog(@"The Address Is:%@",address);
}
}];
}
Happy Coding :)

Community
- 1
- 1

ashwin shrestha
- 107
- 1
- 13