Strange UISearchDisplayController view offset behavior in iOS 7 when embedded in navigation bar

前端 未结 9 966
难免孤独
难免孤独 2020-12-14 03:13

I am building an iOS 7-only app. I am trying to set a UISearchDisplayController into the navigation bar.

I have it set up like this: In the storyboard, I added a \"

9条回答
  •  再見小時候
    2020-12-14 03:28

    definesPresentationContext = true

    override func viewDidLoad() {
            super.viewDidLoad()
    
            searchController = UISearchController(searchResultsController: nil)
            searchController.searchResultsUpdater = self
            searchController.hidesNavigationBarDuringPresentation = false
    
            searchController.dimsBackgroundDuringPresentation = true
            searchController.searchBar.searchBarStyle = UISearchBarStyle.Prominent
            self.tableView.tableHeaderView = searchController.searchBar
    
            definesPresentationContext = true
    

    or see UISearchBar presented by UISearchController in table header view animates too far when active

提交回复
热议问题