使UISearchBar成为UITextField的直接替代品? [英] Making a UISearchBar a drop-in replacement for a UITextField?

查看:94
本文介绍了使UISearchBar成为UITextField的直接替代品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在界面构建器中,UISearchBar似乎在工具栏中显示样式(正如您所期望的那样,考虑它的名称),而UITextField的样式在空白页面上看起来很好。

In interface builder, a UISearchBar seems styled to appear (as you would expect, considering how it is named) in a toolbar, whereas as UITextField is styled to look good on a blank page.

有没有办法让UISearchBar不需要在条形图中 - 例如,如果你想在页面上有多个支持搜索的文本字段?

Is there a way to make a UISearchBar that does not need to be in a "bar" - such as if you wanted to have multiple search-enabled textfields on a page?

我的最终目标是拥有一个充满UITextFields的页面 - 当用户填写表单时,每个页面都会弹出预测性搜索弹出窗口。我可以在导航栏中进行预测搜索 - 但我想启用页面上的每个字段。

My ultimate goal is to have a page full of UITextFields - each of which pops up a predictive search popover as the user fills out the form. I can do the predictive search in a navigation bar - but I want to enable every field on the page.

非常感谢帮助和示例代码指针!

Help and pointers to sample code is greatly appreciated!

推荐答案

实际上,在iOS 5中,UISearchBar在外观上是如此令人难以置信的可定制化,你可以让它看起来就像你希望它看起来一样。因此,没有(并且从来没有,真的)需要它在酒吧。

Actually, in iOS 5, UISearchBar is so incredibly customizable in appearance that you can make it look just about however you want it to look. So there isn't (and never was, really) any need for it to be in a "bar".

看起来很可怕的东西是一个搜索栏,只是为了展示一个真正可定制的UISearchBar而创建的!

This horrible-looking thing is a search bar, created simply to demonstrate how truly customizable a UISearchBar is!

这篇关于使UISearchBar成为UITextField的直接替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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