我在我的应用程序中使用googlemapssdk而不是mapkit,我如何拥有一个文本字段,我必须使用该文本字段来搜索google地图中的位置。
如何使用文字搜索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];
filter.country=@"IN";
[place_client autocompleteQuery:searchString bounds:bounds filter:filter callback:^(NSArray *results, NSError *error) {
//Process result
}];
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句