0

I'm using an integrated UISearchBar with UINavigationItem:

        navigationItem.searchController = searchController
        navigationItem.hidesSearchBarWhenScrolling = false

It looks like this: normal layout

However, when I add prompt to the UISearchBar, the layout breaks and the UI looks like this:

searchController.searchBar.prompt = "Adding text to the SearchBar"

broken layout

What is the cause of this issue and how to resolve it?

3
  • Could you supply the code for adding the addition UILabel to your UISearchBar Commented Apr 3, 2019 at 14:19
  • @RichAppz updated my question Commented Apr 3, 2019 at 14:28
  • Hi, add offset like this :- self.searchController.searchBar.searchFieldBackgroundPositionAdjustment = UIOffsetMake(0, 20); Please tell me it works or not ? Thank You :) Commented Apr 3, 2019 at 14:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.