更改UISearchBar的大小 [英] Changing the size of UISearchBar

查看:61
本文介绍了更改UISearchBar的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

找不到答案,也无法做到这一点

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>;

我问:有没有办法改变UISearchBar的宽度?

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

非常感谢.

推荐答案

只是对有相同问题的任何人的引用:

Just as a reference to anybody with the same problem:

我创建了一个带有searchBar图像(调整大小)作为按钮背景的视图(该按钮已作为子视图添加到我的视图中).

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

然后,我在UiTableViewController中将包含按钮的视图定义为表标题的视图.

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

按下按钮时,其行为类似于searchBar.

The button, when pressed, behaves like the searchBar.

我能够解决我的问题.

这篇关于更改UISearchBar的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆