2014-09-30 1 views
1

Google에서 자동 완성 기능을 사용하여 사용자 위치 주소를 가져 오는 중입니다.Google 자동 완성 위치에서 위도와 경도를 얻는 방법

사용자가 검색 창에 텍스트를 입력하면 relavent 주소가 테이블에 드롭 다운됩니다. 하나의 주소를 클릭하면 해당 주소를 가져옵니다.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

에서 나는이

SPGooglePlacesAutocompletePlace *place = [self placeAtIndexPath:indexPath]; 
[place resolveToPlacemark:^(CLPlacemark *placemark, NSString *addressString, NSError *error) { 
    if (error) { 
     SPPresentAlertViewWithErrorAndTitle(error, @"Could not map selected Place"); 
    } else if (placemark) { 
     [self addPlacemarkAnnotationToMap:placemark addressString:addressString]; 
     [self recenterMapToPlacemark:placemark]; 
     [self dismissSearchControllerWhileStayingActive]; 
     [self.searchDisplayController.searchResultsTableView deselectRowAtIndexPath:indexPath animated:NO]; 

     NSLog(@"Address %@",addressString); 

`

지금은 theselected 주소의 위도와 경도를 얻으려면`

같이 했어요. 어떻게 그걸 얻을 수 있죠. 도와주세요.

당신에게

답변

0

NSLog 감사 (@ "주소 %의 @, % lf를, %의 LF를", addressString, placemark.location.coordinate.latitude, placemark.location.coordinate.longitude); XD