A
A
Andrey Myvrenik2017-10-27 16:00:51
iOS
Andrey Myvrenik, 2017-10-27 16:00:51

Why is the gray overlay covering the entire controller on click on the search box in the UINavigationBar?

iOS 11. I'm trying to make a similar UINavigationBar that is in the standard messenger:
59f32c54bed4f255710546.jpeg
In fact, the following comes out:
59f32c6c0ea1e651427105.jpeg
Everything looks similar, but when you click on the input field, this grayness completely closes everything, including the UINavigationBar and the "Cancel" button. Even the input field cannot be clicked (to change the position of the cursor, etc.). there is a click on the gray overlay and the search is cancelled. How to make the same behavior as in the messenger?
viewDidLoad:

// Large title display mode
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always

// Prepare search bar
let searchController = UISearchController(searchResultsController: nil)
searchController.searchBar.delegate = self
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = true

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Cherny, 2017-10-30
@freeg0r

because it's like a bae to let the user know that these are not search results right now, yet as soon as you start typing in the search bar, the results appear already on a light background. this is the idea of ​​apple UI designers, though the top bar should not get dark, try changing the settings, maybe it's because

navigationItem.hidesSearchBarWhenScrolling = true
Do not be afraid of this dimming, iOS users know and are used to this behavior.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question