在 xcode 中的文本框上创建下拉选项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5974166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating drop down option on text box in xcode
提问by Christina
In my app i am planning to enter my input through a text box .Once entered the input i will be able to get all the data or words corresponding to it from my database .Is there any option to get drop down box from text box or i have to use table view controller only to display my output.Any help will be greatly appreciated.
在我的应用程序中,我计划通过文本框输入我的输入。一旦输入,我将能够从我的数据库中获取与其对应的所有数据或单词。是否有任何选项可以从文本框中获取下拉框或我必须使用表视图控制器来显示我的输出。任何帮助将不胜感激。
Thanks, Christy
谢谢,克里斯蒂
采纳答案by Christina
You can use UIPickerView, its mostly used as a dropdown menu in iOS. But again, its mostly used as an input source. You can go with table view as a standard approach.
您可以使用UIPickerView,它主要用作 iOS 中的下拉菜单。但同样,它主要用作输入源。您可以使用表格视图作为标准方法。
回答by senthilMuthu
You can use UIButton(custom) and set background image with combobox image(you can get from google or create thorough GIMP in MAC), if user presses the button,show UIPIckerview below the button or at the bottom of iphone screen or wherever you want.after selecting value from it, you can hide pickerview and change the title of UIButton.you can achieve this through tableview also.
您可以使用 UIButton(custom) 并使用组合框图像设置背景图像(您可以从谷歌获取或在 MAC 中创建彻底的 GIMP),如果用户按下按钮,则在按钮下方或 iPhone 屏幕底部或您想要的任何位置显示 UIPIckerview .从中选择值后,您可以隐藏pickerview并更改UIButton的标题。您也可以通过tableview实现此目的。
回答by Robert
I know it's a bit late in the day but, for anyone else looking for drop down list functionality, I came across this, which appears to do the trick: http://www.addimage.net/blog/post/2012/04/11/Apple-iOS-Drop-Down-Menu-class.aspx
我知道现在有点晚了,但是对于任何其他正在寻找下拉列表功能的人,我遇到了这个,这似乎可以解决问题:http: //www.addimage.net/blog/post/2012/04 /11/Apple-iOS-Drop-Down-Menu-class.aspx
回答by Alex Terente
You can use an UISearchBarand UISearchBarDelegateand update an UITableView. To get the idea look at the contacts app in your iPhone.
您可以使用UISearchBar和UISearchBarDelegate并更新UITableView。要了解这个想法,请查看 iPhone 中的联系人应用程序。