Trichophyton Trichophyton - 1 year ago 69
Objective-C Question

UISearchbar scope is hidden behind the search text zone after adding constraint

I've come up against a problem I cannot sort out. I have a nib file where I added a table view and a UISearchbar with a scope bar. Everything was working perfectly until I added constraints to all the views (tableview, searchbar, a few labels and buttons). Since that moment, I cannot see the scope bar anymore. It seems to be hidden behind the searchbar because I can see a kind of blue surrounding the search area where text is entered (see below):

enter image description here
Does anyone have already been facing this problem?

This is the image with the constraints mentioned as a possible issue:

enter image description here

Answer Source

There might be either of below two constraint causing the issue.

  1. Height constraint to the searchBar - you can resolve this by deleting the height constraint

enter image description here


  1. If your tableview has top constraint to the superview you will need to either delete it or you will not increase it till you see the scope bar.

enter image description here