Prevent UISearchController from hiding the navigat

2019-04-21 14:29发布

问题:

When a UISearchController's search bar becomes active, it hides the view's navigation bar. I'd like to have the search bar active below the navigation bar.

In iOS 7 there was a good way to do this for UISearchDisplayController here: https://stackoverflow.com/a/12529945/3799720

But now in iOS 8 with UISearchController I can't figure out how to do this.

回答1:

This might have something to do with the UISearchController hidesNavigationBarDuringPresentation property.



回答2:

yourSearchController.hidesNavigationBarDuringPresentation = false

this works in swift



标签: ios ios8