xcode 改变 UISearchBar 的大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2523385/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Changing the size of UISearchBar
提问by camilo
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?
请问:有没有办法改变UISearchBar的宽度?
Thanks a lot.
非常感谢。
采纳答案by camilo
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).
我使用 searchBar 图像(调整大小)创建了一个视图作为按钮的背景(该按钮作为子视图添加到我的视图中)。
Then I defined the view containing the button as the view for the table's header in my UiTableViewController.
然后我将包含按钮的视图定义为 UiTableViewController 中表格标题的视图。
The button, when pressed, behaves like the searchBar.
该按钮在按下时的行为类似于 searchBar。
I was able to solve my problem.
我能够解决我的问题。