views:

343

answers:

2

Hi.

Not being able to find the answer, and also not being able to do what I want with

CGSize searchBarSize = self.searchDisplayController.searchBar.frame.size; searchBarSize.width = ;

I ask: is there a way to change the width of a UISearchBar?

Tanks a lot.

A: 

See This Post

All the best.

Warrior
Thanks for the answer. I almost got there using [self.searchDisplayController.searchBar setBounds:CGRectMake(0,0,80,30)]; but it didn't work the way I wanted, because despite being able to resize the height of the UISearchBar, I couldn't change its height. Any ideas?
camilo
CGRectMake(x position,y position,width,height).Change the 4 values to your desired output.
Warrior
Using that, I can change the height but not the width. :-/
camilo
better try search bar instead of searchDisplayController
Warrior
Thanks for keep answering me. In fact, what I'm trying to do is to resize a searchBar associated with a searchDisplayController, and I'm accessing it with self.searchDisplayController.searchBar. I can do "almost" everything with it.I'm just not sure if it is possible to change its width.
camilo
In that post, it's the searchResultsTableView frame which is being changed. Using that code (adapted) to change my searchBar gets me to where I always was: width keeps constant. Once again, and even without having an answer yet, can't thank you enough for the spared time.
camilo
A: 

Just as a reference to anybody with the same problem:

I created a view with the searchBar image (resized) as a button's background (the button was added as a subview to my view).

Then I defined the view containing the button as the view for the table's header in my UiTableViewController.

The button, when pressed, behaves like the searchBar.

I was able to solve my problem.

camilo