syedfa syedfa - 5 months ago 24
Swift Question

Trying to make UISearchController function like language settings in iPhone in Swift

I currently have implemented a UISearchController which is currently working fine. Here are the attached screens that show how:

enter image description here enter image description here enter image description here enter image description here

However, what I would like to do is implement it in a way that looks like how Apple implemented their language selection option in settings on the iPhone:

enter image description here enter image description here enter image description here

In Apple's implementation, the search bar does not hide the navigation bar when it is active. Does anyone know how to achieve this functionality in Swift instead of the conventional way which I have implemented currently? Just wondering.

Thanks in advance to all who reply.

Than

Answer

There is a property called hidesNavigationBarDuringPresentation in the UISearchController class that by default is true that handle what do you want, so put it in false and you can achieve keep the navigation bar during the presentation as Apple do in the Language options:

searchbBarController.hidesNavigationBarDuringPresentation = false

I hope this help you

Comments