UISearchBar in UINavigationBar with ScopeBar

Posted by ncipollina on Stack Overflow See other posts from Stack Overflow or by ncipollina
Published on 2012-07-10T21:08:02Z Indexed on 2012/07/10 21:15 UTC
Read the original article Hit count: 248

I am trying to put a UISearchBar inside of the UINavigationBar, which I am able to do without much problem. The problem is that I have logic when editing to show the Scope Bar. This all works fine, with one exception. The navigation bar tries to center the UISearchBar inside of the title view. This causes the search bar to move up above the navigation bar. I tried adding some logic to set the frame of the search bar so that it just draws overtop of my main view, which is fine. I can only set the height, which causes the search bar to draw over the view just fine, but it isn't wide enough to cover the whole screen. If I set the width on the frame, it goes back to the same behavior of trying to center the UISearchBar on the navigation bar. Anyone know how I can accomplish this?

Thanks,

Nick

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios