UISearchBar animation hidding button

Posted by David Carvalho on Stack Overflow See other posts from Stack Overflow or by David Carvalho
Published on 2010-06-09T13:26:22Z Indexed on 2010/06/15 17:02 UTC
Read the original article Hit count: 389

Hello

I currently have a UISearchBar (attached to a UISearchDisplayController), but I reduced the width of the search bar so I could display a custom button to its right when the search bar is not selected. The button is used to access other views.

However, when I select the search bar and then press cancel (or even perform a search) and return to the normal view, where the search bar should be displayed with my custom button, the search bar animates and takes up all the room for the button and the is not displayed. Essentially, the search bar takes up all the width of the screen when I only want it to take up a part of it.

Is there any way to prevent the search bar from animating to the whole width of the screen?

This is how I defined the CGRect of the search bar:

self = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 250.0f, 45.0f)]

Any help would be great.

Regards

© Stack Overflow or respective owner

Related posts about iphone

Related posts about animation