Show search bar in navigation bar without scrolling on iOS 11

后端 未结 4 1866
南方客
南方客 2020-12-04 13:00

I’m attaching a UISearchController to the navigationItem.searchController property of a UITableViewController on iOS 11. This works fine: I can use the nice iOS

4条回答
  •  情深已故
    2020-12-04 13:58

    You can set the property isActive to true after adding the searchController to the navigationItem.

    Just like this:

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        searchController.isActive = true
    }
    

提交回复
热议问题