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 -->
[searchBar setNeedsLayout]
in -searchBarTextDidBeginEditing
auto-resizing mask
options in IB
Edit: Didn't mention, but this is on iPhone (as we can put searchbar
inside toolbar in iPad..)
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With