2016-04-29 13 views
0

こんにちは私は私のアプリでGoogleマップ上で作業しています、私はそれを完全に追加し、現在の場所を取得します。私は次のコードでGoogleマップに検索機能を追加しました。uisearchbarで検索するGoogleマップの場所を表示するには?

- (void)viewController:(GMSAutocompleteViewController *)viewController 
    didAutocompleteWithPlace:(GMSPlace *)place { 
// Do something with the selected place. 
NSLog(@"Place name %@", place.name); 
NSLog(@"Place address %@", place.formattedAddress); 
NSLog(@"Place attributions %@", place.attributions.string); 


[self dismissViewControllerAnimated:YES completion:nil]; 
} 

- (void)viewController:(GMSAutocompleteViewController *)viewController 
didFailAutocompleteWithError:(NSError *)error { 
// TODO: handle the error. 
NSLog(@"error: %ld", (long)[error code]); 
[self dismissViewControllerAnimated:YES completion:nil]; 
} 

    // User canceled the operation. 
- (void)wasCancelled:(GMSAutocompleteViewController *)viewController { 
NSLog(@"Autocomplete was cancelled."); 
[self dismissViewControllerAnimated:YES completion:nil]; 
} 

私は検索バーに何かを入力すると、それは私の場所のための提案を提供します。今私はその場所をGoogleマップに追加したいと思います。それは私がしたいことです。

+0

私はロカトン座標を取得します –

+0

仲間私は場所と名前だけを取得しています –

答えて

1

GMSAutoCompleteViewControllerは、あなただけのテーブルビューにつながる検索与えるありがとうございます。結果を地図に表示するには、新しい地図ビューを使用するか、tableviewから選択した場所に表示されます。 または、GMSAutocompleteFetcherを使用して結果を取得し、マップビューで表示します。

+0

ありがとうございます。私はGMSAutoCompleteControlleで動作します –

+0

私は場所についてはtableviewを取得していますが、マップ上でそれを更新することはできませんか? –

関連する問題