我正在将 GMSAutocompleteResultsViewController 用于Google自动填充搜索位置。当我用此搜索时,它显示的结果非常有限。它并不显示所有结果。而且,当它在android中使用时,它会显示许多结果。请让我知道我在想什么。
override func viewDidLoad() {
super.viewDidLoad()
resultsViewController = GMSAutocompleteResultsViewController()
resultsViewController?.delegate = self
searchController = UISearchController(searchResultsController: resultsViewController)
searchController?.searchResultsUpdater = resultsViewController
// Put the search bar in the navigation bar.
searchController?.searchBar.sizeToFit()
navigationItem.titleView = searchController?.searchBar
// When UISearchController presents the results view, present it in
// this view controller, not one further up the chain.
definesPresentationContext = true
// Prevent the navigation bar from being hidden when searching.
searchController?.hidesNavigationBarDuringPresentation = false
}
答案 0 :(得分:2)
我已经找到答案了。 Google API for iOS仅提供5个搜索结果,而Android则提供了更多结果。您可以参考以下链接
https://developers.google.com/places/web-service/autocomplete#place_autocomplete_responses