Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
208 views
in Technique[技术] by (71.8m points)

ios5 - Making a UISearchBar a drop-in replacement for a 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.

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...