Giter Site home page Giter Site logo

dropdownmenu's Introduction

License MIT  Cocoapods  Cocoapods 

ZHDropDownMenu

简介

swift实现的一个方便、实用的下拉菜单控件,也可以用来实现 NSComboBox的效果。

支持swift 3.0。在低版本的swift中可能无法直接使用。

效果演示

功能

  • 支持Storyboard/Xib可视化设置属性,所见即所得
  • 可以根据需要决定是否允许用户手动编辑文字
  • 下拉按钮的图片、字体、文本颜色、边框等属性可以自己设置,你可以定制出你自己需要的样式

安装

Cocoapods

  1. 在 Podfile 中添加 pod "ZHDropDownMenu"
  2. 执行 pod installpod update

手动安装

  1. 下载 ZHDropDownMenu 文件夹内的所有内容。
  2. 将 ZHDropDownMenu 文件夹添加(拖放)到你的工程。

使用

  1. 在storyboard中添加一个View然后设置Class为ZHDropDownMenu,然后选中它,在右边进行设置。

  2. 在代码中设置它的其他属性

    menu.options = ["1992","1993","1994","1995","1996","1997","1998"]//设置下拉列表项数据
    menu.defaultValue = "1992" //设置默认值
    menu.editable = false //禁止编辑
    menu.showBorder = false //不显示边框
    menu.delegate = self //设置代理
    
  3. 实现协议中的回调方法

    //选择完后回调
    func dropDownMenu(menu: ZHDropDownMenu!, didChoose index: Int) {
        print("\(menu) choosed at index \(index)")
    }
    
    //编辑完成后回调
    func dropDownMenu(menu: ZHDropDownMenu!, didInput text: String!) {
        print("\(menu) input text \(text)")
    }
    

系统要求

该项目最低支持 iOS 8.0。

许可证

ZHDropDownMenu 使用 MIT 许可证,详情见 LICENSE 文件。

dropdownmenu's People

Contributors

zhubinchen avatar jamesthekid avatar xylxi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.