Show search bar in navigation bar without scrolling on iOS 11

后端 未结 4 1872
南方客
南方客 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:49

    On iOS 13, @Jordan Wood's answer didn't work. Instead I did:

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

提交回复
热议问题