s-t
s-t

Reputation: 395

UISearchBar: how can I stop it resizing when clicked?

I have a UISearchBar (with UISearchDisplayController) as title view of UINavigationBar. There are also two buttons on either side of the searchbar within the navbar.

When clicking on UISearchBar, it becomes wider and covers the button on the right of it.

How can I stop it from becoming wider?

Things tried but didn't work -->

Edit: Didn't mention, but this is on iPhone (as we can put searchbar inside toolbar in iPad..)

Upvotes: 6

Views: 4522

Answers (1)

s-t
s-t

Reputation: 395

Actually, taking hint from this answer if the search bar is put in UIView of desired size then this is set as title view of NavBar, it doesn't go wider !

But... Since you can't make cancel button to show/not show as you wish, I realized it's not so useful.
(As seen in this question/answer etc)

Upvotes: 9

Related Questions