【问题标题】:How to add options list in iOS app using swift programmatically?如何以编程方式使用 swift 在 iOS 应用程序中添加选项列表?
【发布时间】:2017-04-27 01:07:37
【问题描述】:

我是 iOS 编程新手。我正在开发一个应用程序,它会要求用户从下拉选项菜单中选择他/她的血型。我想以编程方式构建它。有人可以帮我吗?

【问题讨论】:

  • 也许你应该使用UIPickerView
  • 我用过,但视图显示在应用程序的底部。我想要一个文本字段内的下拉菜单。
  • 那你就得用TableView了,像动画一样自定义下拉。
  • 您能否详细说明,例如指向某处或某段代码的链接。
  • 你可以在cocoacontrols.com找到更多控制

标签: ios swift


【解决方案1】:

你可以使用这个库,它非常好,对开发人员友好且易于定制

只需几行代码即可实现非常简单,在 Swift 中使用示例,也可以查看 github 中的示例

    dropDown = DropDown()

    // The view to which the drop down will appear on
    dropDown.anchorView = inputToolbar // your textfield
    dropDown.direction = .Top
    dropDown.dataSource = [String] //your datasource

【讨论】:

    猜你喜欢
    • 2015-01-07
    • 2011-12-04
    • 1970-01-01
    • 2011-04-28
    • 1970-01-01
    • 2021-08-13
    • 2014-11-28
    • 1970-01-01
    相关资源
    最近更新 更多