Making a UISearchBar a drop-in replacement for a UITextField?

我只是一个虾纸丫 提交于 2019-12-12 03:06:14

问题


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.

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?

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!


回答1:


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".

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



来源:https://stackoverflow.com/questions/10792578/making-a-uisearchbar-a-drop-in-replacement-for-a-uitextfield

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!