我在我的应用程序中使用googlemapssdk而不是mapkit,我如何拥有文本字段我必须使用该文本字段来搜索Google地图中的地点。如何使用uitextfield搜索谷歌地图中的地方sdk
如何使用文本搜索googlemaps sdk中的地点以及如何获取搜索到的地点经纬度的特定位置。
我已经经历了堆栈溢出中的所有问题,但我无法理解它们,所以请帮我解决这个问题。
感谢您的快速解答。
我在我的应用程序中使用googlemapssdk而不是mapkit,我如何拥有文本字段我必须使用该文本字段来搜索Google地图中的地点。如何使用uitextfield搜索谷歌地图中的地方sdk
如何使用文本搜索googlemaps sdk中的地点以及如何获取搜索到的地点经纬度的特定位置。
我已经经历了堆栈溢出中的所有问题,但我无法理解它们,所以请帮我解决这个问题。
感谢您的快速解答。
//You can perform search by tapping search button using the following code
- (IBAction)searchButtonPressed:(id)sender {
[self searchForLocationWithText:self.searchTextField.text];
}
//Else If you want to perform the search on typing each letter, You can use this delegate method
- (void)textFieldDidChange:(NSNotification *)notification {
[self searchForLocationWithText:self.searchTextField.text];
}
//Method for searching
- (void)searchForLocationWithText:(NSString *)searchString{
GMSCoordinateBounds *bounds = [self getGMSBoundsWithRadiusInMeters:10000];
GMSAutocompleteFilter *filter = [[GMSAutocompleteFilter alloc] init];
[email protected]"IN";
[place_client autocompleteQuery:searchString bounds:bounds filter:filter callback:^(NSArray *results, NSError *error) {
//Process result
}];
}
感谢 –
@SatheeshkumarNaidu:我刚刚添加代码,使用textField中的文本进行搜索,并根据上述代码会给你结果,你必须处理这些结果,像加载本地数组并显示在tableView中。休息我希望你能理解和照顾。 – Bharath
我必须在谷歌地图中显示的搜索结果,例如,如果我搜索印度,我已经在谷歌地图中显示印度。您是否拥有任何代码 –
谷歌本身提供了一些用于自动完成搜索的api,您可以使用它们来获取纬度和更多。 – vaibhav
感谢您快速回复vaibhav,如何使用textfelid进行搜索以及我可以在哪里获得apis,请给出链接以及如何使用该apis。 –
请参阅此https://www.google.co.in/?gws_rd=ssl#q=google+places+autocomplete+api+example+ios。搜索的地方如何使用的UITextField – vaibhav