GMSAutocompleteResultsViewController GoogleMap搜索列表布局问题

问题描述

我陷入了困境。我正在使用Google自动完成的地方信息。

引用链接:https://developers.google.com/places/ios-sdk/autocomplete#add_a_search_bar_to_the_navigation_bar

已正确实施。但是,当用户搜索任何地址并向上或向下倾斜设备时,结果列表都会更改其位置,并且看起来很糟糕。

视频参考:https://gofile.io/d/b3Cd1j

下面是我的代码,我在其中设置了地点自动填充搜索栏:

    let filter = GMSAutocompleteFilter()
    filter.country = "US"
    
    resultsViewController = GMSAutocompleteResultsViewController()
    resultsViewController?.autocompleteFilter = filter
    resultsViewController?.delegate = self
    
    searchController = UISearchController(searchResultsController: resultsViewController)
    searchController?.searchResultsUpdater = resultsViewController
    searchController?.delegate = self
    
    if #available(iOS 13.0,*) {
        searchController?.automaticallyShowsCancelButton = false
    } else {
        // Fallback on earlier versions
    }
    
    // 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
    
    searchController?.searchBar.isHidden = true

有人可以帮我吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)