2010-07-24 95 views
0

我正在iphone中做一個基於地圖的應用程序,我需要獲取地圖視圖中心的位置。我需要在用戶拖動/移動/縮放地圖視圖時更新位置。這樣我就可以從地圖上獲取緯度/經度信息,並且可以將這些信息發送到谷歌API獲取地址信息。從iphone獲取位置mapview

任何人都可以有任何想法如何做到這一點可能嗎?請幫忙。

在此先感謝 世斌中號

+0

能否請您指定此代碼的一部分,應該在.H寫,哪些應該寫在.M與代碼的一些解釋。對不起,要求更多,但我對所有這些事情都很陌生,並且很難理解代碼。謝謝, – Ashutosh 2010-07-25 15:58:18

回答

1

擺脫你必須使用谷歌reverseGeocoder API的地址信息。

這裏你傳遞你的經緯度。

MKReverseGeocoder *reverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate]; 
reverseGeocoder.delegate = self;  
[reverseGeocoder start]; 

在這裏你可以獲得地址信息

-(void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark 
{ 
    NSDictionary *address = [[NSDictionary alloc]initWithDictionary:placemark.addressDictionary];  
    NSLog(@"%@",address); 
}