UISearchBar height reverting to custom view's height

929 views Asked by At

I have a custom view header on a Table View Controller, and within that I have a couple labels and a UISearchBar. This issue is when I cancel out of the Search Display Controller, the UISearchBar animates back into it's origin, but upon finish it changes its height to the custom view's height like so:

Original Before Search SearchBar Height Overlapping after cancelling

Is there a way to prevent this from happening without AutoLayout (project is using struts and springs)? Or is there a method to override the animation coming out of the Display Controller?

I've uploaded a quick sample project to github: https://github.com/3arrett/searchbarheight

1

There are 1 answers

8
Tom On

UISearchBar will be placed in the center of the top container view after animation, so the solution I have got is to place two UIView, one for UISearchBar, another for Labels, also the height of the UIView which contained the UISearchBar should be same height as UISearchBar, for instance, 44.

Looks like this one - enter image description here