Changing the size of UISearchBar

2019-05-19 01:31发布

问题:

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

CGSize searchBarSize = self.searchDisplayController.searchBar.frame.size;
searchBarSize.width = <someNumber>;

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

Thanks a lot.

回答1:

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.