Search code examples
iosuisearchbarxcode10ios12

UISearchBar prompt appears ON the bar, not at top of it


I do not know if this is a known or unknown bug, but in my case, the prompt label appears ON the bar, not at the top of the bar, like the following:

enter image description here

It is the default search bar, dragged and dropped into a view and its constraints are set as they should be. As you can see only its placeholder and prompt attributes are changed.

The problem occurs with iOS 12.1 (both simulator and device) and Xcode 10.1 I was not able to find anything about it. I have to use that prompt thing! Has anyone any idea or any of you are able to reproduce the issue?


Solution

  • It gives you more flexible when you adjust the background offset.

    enter image description here

    After add Constraints, the running screen looks fine.

    enter image description here