By Using the following code you can integrate the Google Maps SDK in your iOS project.
First we will write the function which results the array of related nearby places.
- -(void) searchLocation:(NSString *)locationName{
- GMSAutocompleteFilter *filter;
- filter.type=kGMSPlacesAutocompleteTypeFilterGeocode;
- GMSVisibleRegion visibleRegion = _mapView.projection.visibleRegion;
- GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion: visibleRegion];
- [[GMSPlacesClient new] autocompleteQuery:locationName bounds:bounds filter:filter callback:^(NSArray *results,NSError *error){
- if (error != nil) {
- [locationAray removeAllObjects];
- [self.locationTableView reloadData];
- return;
- }
- if ([results count]>0) {
- [locationAray removeAllObjects];
- [locationAray addObjectsFromArray:results];
- [self.locationTableView reloadData];
- }
No comments:
Post a Comment