предложения панели поиска охватывают весь экран - PullRequest
0 голосов
/ 06 апреля 2020

Когда я нажимаю на панель поиска, предложения охватывают весь экран. Это происходит только для исходной поисковой панели, для подсказок целевой панели поиска под поисковой панелью.

Как я могу это исправить? Спасибо

нажата панель поиска

func arrangeSearchBars(){

    // Search Table display recommendations
   let locationSearchTable = storyboard!.instantiateViewController(withIdentifier: "LocationSearchTable") as! LocationSearchTable
   let PopupLocationSearchTable = storyboard!.instantiateViewController(withIdentifier: "PopupLocationSearchTable") as! PopupLocationSearchTable

    locationSearchTable.handleMapSearchDelegate = self
           locationSearchTable.additionalSafeAreaInsets = UIEdgeInsets(top: 50 , left: 0, bottom: 0, right: 0)

    PopupLocationSearchTable.handleMapSearchDelegate = self
    fromSearchController = UISearchController(searchResultsController: PopupLocationSearchTable)
    PopupLocationSearchTable.additionalSafeAreaInsets = UIEdgeInsets(top: 100 , left: 0, bottom: 0, right: 0)

    definesPresentationContext = true

    fromSearchController.searchResultsUpdater = PopupLocationSearchTable
     let fromSearchBar = fromSearchController.searchBar

    fromSearchBar.setImage(UIImage(), for: .clear, state: .normal)
    fromSearchBar.setBackgroundImage(UIImage(), for: .any, barMetrics: .default)
    fromSearchBar.placeholder = "Origin"

    myFrom.addSubview(fromSearchController.searchBar)

    toSearchController = UISearchController(searchResultsController: locationSearchTable)

    toSearchController.searchResultsUpdater = locationSearchTable
    let toSearchBar = toSearchController.searchBar
    toSearchBar.sizeToFit()

    toSearchBar.setImage(UIImage(), for: .clear, state: .normal)
    toSearchBar.setBackgroundImage(UIImage(), for: .any, barMetrics: .default)

    toSearchBar.placeholder = "Destination"

    myTo.addSubview(toSearchController.searchBar)

    var searchBarFrame = fromSearchController.searchBar.frame
     searchBarFrame.size.width = myFrom.frame.size.width - 15
     fromSearchController.searchBar.frame = searchBarFrame
     toSearchController.searchBar.frame = searchBarFrame

     self.fromSearchController.hidesNavigationBarDuringPresentation = true
     self.toSearchController.hidesNavigationBarDuringPresentation = true

  }
...