问题
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