2015-10-28 109 views
0

我喜歡手動添加註釋(當在地圖視圖中的特定地點的用戶觸摸),並獲得該位置(經度,緯度,地址)的細節..如何手動添加註釋以在iOS中映射視圖?

感謝支持...

+0

重複的http://stackoverflow.com/questions/3959994/how-to-add-a-push-pin-to-a-mkmapviewios-when-touching/3960754#3960754 – iPrabu

+0

@iPrabu - 如何獲取位置的詳細信息以及如何更改註釋位置.. – Barani

回答

0

爲@iPrabu指向similar post,具有很好的和正確答案你的問題......對於第二部分即得到細節有關location..you可以做這樣的事情

-(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); 
    } 
}]; 
} 

編碼愉快:)