2016-05-12 83 views
5
let autocompleteController = GMSAutocompleteViewController() 
autocompleteController.autocompleteFilter?.country = "AU" 
autocompleteController.delegate = self 
self.presentViewController(autocompleteController, animated: true, completion: nil) 

我只需要筛选澳大利亚的数据,所以我想按国家过滤数据。谷歌自动完成的地方国家过滤器不工作在iOS

回答

13

的autocompleteFilter属性默认为零,因此行

autocompleteController.autocompleteFilter?.country = "AU" 

没有做任何事情。像这样做,而不是:

let filter = GMSAutocompleteFilter() 
filter.country = "AU" 
autocompleteController.autocompleteFilter = filter 
1

GMSAutocompleteViewController *controller = [[GMSAutocompleteViewController alloc]init]; 
 
    GMSAutocompleteFilter *filter = [[GMSAutocompleteFilter alloc]init]; 
 
    controller.delegate = self; 
 
    filter.country = @"IN"; 
 
    controller.autocompleteFilter = filter;

相关问题