我使用这种方法来获得建议自动完成,我需要让他们在实现代码如下:访问结果Places API的IOS为
- (void)placeAutocomplete:(NSString *)autoCompleteString {
[self.autoCompleteSuggestionsList removeAllObjects];
GMSAutocompleteFilter *filter = [[GMSAutocompleteFilter alloc] init];
filter.type = kGMSPlacesAutocompleteTypeFilterCity;
[_placesClient autocompleteQuery:(NSString *)autoCompleteString
bounds:nil
filter:filter
callback:^(NSArray *results, NSError *error) {
if (error != nil) {
NSLog(@"Autocomplete error %@", [error localizedDescription]);
return;
}
for (GMSAutocompletePrediction* result in results) {
//NSLog(@"Result '%@' with placeID %@", result.attributedFullText.string, result.placeID);
//NSRange autoCompleteRange = [result.attributedFullText.string rangeOfString:autoCompleteString];
//if (autoCompleteRange.location == 0) {
//NSString *stringNow = [NSString stringWithFormat:@"%@",result.attributedFullText.string];
[self.autoCompleteSuggestionsList addObject:result.attributedFullText.string];
//NSLog(@"test : %@",stringNow);
//NSLog(@"%@",self.autoCompleteSuggestionsList);
//}
}
}];
[self.autocompleteTableView reloadData];
NSLog(@"%@",self.autoCompleteSuggestionsList);
}
,但我不能autocompleteQuery方法的外部访问结果
当记录它显示正确的内部方法,但不是外面, 我使用可变数组来访问它,但我显示正确内,但不是外部。
我不需要使用任何第三方自动填充窗格的建议。 我得到的结果,我只是需要他们从该方法访问,以便它可以访问以显示桌面以及
重装表 –
谢谢哥们非常感谢你(完for循环后): –
谢谢谢谢,请通过为他人 –