Latest 0.3.0
Homepage https://github.com/davecom/DKDropMenu
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

DKDropMenu is a simple iOS drop down list written in Swift. It expands and collapses. It allows the user to select only one item at a time. Items are just Strings. A delegate is notified when selection occurs. DKDropMenu is IBDesignable and IBInspectable with customizable colors, font, and row heights.

DKDropMenu1
DKDropMenu2

Installation

Use the cocoapod DKDropMenu or simply include DKDropMenu.swift in your project. DKDropMenu 0.3.0 and above requires Swift 4. Use version 0.2.0 for Swift 3 Support. Use version 0.1.6 for Swift 2 support.

Usage

Create a DKDropMenu in IB or in code (using UIView’s init methods). Then add items and set a delegate:

dropMenu.add(names: ["hello", "goodbye", "why?"])
dropMenu.delegate = self

Make sure to implement the single method the delegate (DKDropMenuDelegate) must implement:

func itemSelected(withIndex: Int, name: String) {
    println("(name) selected");
}

The delegate can also optionally implement the method

func collapsedChanged()

to be notified when the collapse status of the menu changes.

Items can be added or removed

func add(names: [String])
func add(name: String)
func remove(atIndex: Int)
func remove(name: String)
func removeAll()

The properties collapsed (Bool) and selectedItem (String) can be manually modified.

License and Authorship

Released under the MIT License. Copyright 2015-2016 David Kopec. Please open issues on GitHub.

Latest podspec

{
    "name": "DKDropMenu",
    "version": "0.3.0",
    "license": "MIT",
    "summary": "A simple iOS drop down list written in Swift.",
    "homepage": "https://github.com/davecom/DKDropMenu",
    "social_media_url": "https://twitter.com/davekopec",
    "authors": {
        "David Kopec": "[email protected]"
    },
    "source": {
        "git": "https://github.com/davecom/DKDropMenu.git",
        "tag": "0.3.0"
    },
    "screenshots": "https://raw.githubusercontent.com/davecom/DKDropMenu/master/DKDropMenu.png",
    "platforms": {
        "ios": "8.0"
    },
    "frameworks": "UIKit",
    "source_files": "DKDropMenu.swift",
    "requires_arc": true,
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This