iOS 下拉视图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21900315/
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
iOS drop down view
提问by IssacZH.
I have been searching for drop down view (expand & collapse view) that basically expand when user clicked on it or collapse.
我一直在寻找下拉视图(展开和折叠视图),当用户点击它或折叠时,它基本上会展开。
The drop down is basically use to include textview/textfield. Till now I could not manage to find how to create this drop down view. What I managed to find is drop down menu which is sort of like an option picker that allows you to select an option. I just wanted to include text only. Is it possible to ask for some pointers regarding this?
下拉菜单主要用于包含 textview/textfield。直到现在我无法找到如何创建这个下拉视图。我设法找到的是下拉菜单,它有点像一个选项选择器,允许您选择一个选项。我只想包含文本。是否有可能就此提出一些建议?
Thanks.
谢谢。
回答by Darkseal
I also needed a HTML select-like control (single-selection dropdown list) without breaking the XCode legacy GUI interface across past and future iOS releases.
我还需要一个类似 HTML 选择的控件(单选下拉列表),而不会破坏过去和未来 iOS 版本的 XCode 遗留 GUI 界面。
I ended up coding DownPicker, a lightweight control which does just that combining UITextField
and UIPickerView
. It can be used either as custom control (UIDownPicker
) or also as control wrapper, upgrading any existing UITextField
.
我最终编写了 DownPicker,这是一个轻量级控件,它可以将UITextField
和UIPickerView
. 它既可以用作自定义控件 ( UIDownPicker
),也可以用作控件包装器,升级任何现有的UITextField
.
Here's how it looks like:
这是它的样子:
For more info and download you can check this brief tutorialor the GitHub project page(both wrote by me - the project is open-source).
有关更多信息和下载,您可以查看此简短教程或GitHub 项目页面(均由我编写 - 该项目是开源的)。
回答by ayniam
Yes. There is no dropdown component available in ios. And its really frustrating to build a basic component. However, VPPDropDown is there to solve your problem. https://github.com/vicpenap/VPPDropDown
是的。ios 中没有可用的下拉组件。构建一个基本组件真的很令人沮丧。但是,VPPDropDown 可以解决您的问题。https://github.com/vicpenap/VPPDropDown
回答by rahul
There is no dropdown available in iOS. You should create it with text field and tableview. Use below links for references:
iOS 中没有可用的下拉菜单。您应该使用文本字段和 tableview 创建它。使用以下链接作为参考:
iOS-Examples--UITableView-Combo-Box
iOS-Examples--UITableView-Combo-Box
回答by Seungyoun Yi
you can see this one too. This library is written with Swift 3
你也可以看到这个。这个库是用 Swift 3 编写的
https://github.com/younatics/YNDropDownMenu
回答by manish
http://gabriel-tips.blogspot.in/2011/10/uitableview-display-and-hide-cells-as.htmlyou can take it as reference, table view is good and efficient way for dropdown. if you got any other way then please let me know..
http://gabriel-tips.blogspot.in/2011/10/uitableview-display-and-hide-cells-as.html你可以把它作为参考,表格视图是下拉菜单的好方法。如果您有任何其他方式,请告诉我..
回答by Vishal Singh
Adding more options here. People looking for dropdown in iOS can also give VSDropdown a try:
在此处添加更多选项。在 iOS 中寻找下拉菜单的人也可以试试 VSDropdown:
It automatically controls many stuffs like frame, direction, appearance and dismissal when tapped outside bounds.
当在边界外轻敲时,它会自动控制许多东西,如框架、方向、外观和解除。