0

enter image description here enter image description here

I have a tableviewcontroller with a button, textfield, and a search bar display controller in the header view of the tableview.

When I click on the searchbar, then on either cancel or the background tableview(to dismiss it), the search bar will re size to cover the entire view it was in(over the button and text field).

In viewDidLoad I have

self.searchBar.translatesAutoresizingMaskIntoConstraints = YES; 

http://i479.photobucket.com/albums/rr152/nebulouslove/photo.png

Any ideas please?

1 Answer 1

1

Just add height and width constraints to the search bar and pin it to top, left, and right.

You can do that here:

here:

Sign up to request clarification or add additional context in comments.

7 Comments

Can I add constraints in IB and how do I pin in IB? Under the size inspector tab for the search bar, I have the top middle red dot picked. So it seems to expand to the left, right, and down.
I'm trying to find it! But I can't :( I have something that says...The selected views have no constraints. At build time explicit left, top, width, and height constraints will be generated for the view.
You need to click on the search bar and then on the icon I show you in my picture. Then click on height, width, and the three red things on top.
THanks! brilliant I was wondering where the strut like feature went
but now when I hit cancel I get errors :( Assertion failure in -[UITableView layoutSublayersOfLayer:] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.