Latest 1.0.4
Homepage https://github.com/janeshsutharios/JKDropDown
License MIT
Platforms ios 9.0
Authors

JKDropDown ios Swift dropdwon menu

JKDropDown is simple light weight Swift dropdown

JKDropDown

Features

  • We can use dropdown easy in/out animation with up/down direction:
    dropDownObject.showJKDropDown(senderObject: buttonSelect, height: 180, arrayList: arrayIs , arrayImages: imageArray,buttonFrame:buttonFrame!,direction : "down")// you can set "up"

Usage

Import Localize at the top of each Swift file that will contain localized text.
Add JKDropDownDelegate in your Class:

class ViewController: UIViewController,JKDropDownDelegate {}

Create CGRect variable which is used to getting Button frame:

 var buttonFrame : CGRect?

Create JKDropDown object

 var dropDownObject:JKDropDown!

Assign values to buttonFrame with parent view:

 buttonFrame = view.convert(buttonSelect.frame, to: view)//view is parent view (self.view)

Setting up with CocoaPods

source 'https://github.com/janeshsutharios/JKDropDown.git'
pod 'JKDropDown', :git => 'https://github.com/janeshsutharios/JKDropDown-ios-swift-dropdown-menu.git'

Example usage

import UIKit
class ViewController: UIViewController,JKDropDownDelegate {
    @IBOutlet weak var buttonSelect : UIButton!
    var buttonFrame : CGRect?
    var dropDownObject:JKDropDown!
    var arrayIs : [String] = ["Edit","Love","Music","Location"]
    let imageArray = ["1","2","3","4"]
    override func viewDidLoad() {
        super.viewDidLoad()
        buttonSelect.addTarget(self, action: #selector(tapsOnButton), for: UIControlEvents.touchUpInside)
    }
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(true)
        buttonFrame = view.convert(buttonSelect.frame, to: view)
    }
    func tapsOnButton() {
        if dropDownObject == nil {
            dropDownObject = JKDropDown()
            dropDownObject.dropDelegate = self
            dropDownObject.showJKDropDown(senderObject: buttonSelect, height: 180, arrayList: arrayIs , arrayImages: imageArray,buttonFrame:buttonFrame!,direction : "down")
            view.addSubview(dropDownObject)

        }
        else {
            dropDownObject.hideDropDown(senderObject: buttonSelect,buttonFrame:buttonFrame!)
            dropDownObject = nil
        }
    }
    func recievedSelectedValue(name: String, imageName: String) {
        dropDownObject.hideDropDown(senderObject: buttonSelect, buttonFrame: buttonFrame!)
        dropDownObject = nil
        buttonSelect.setTitle(name, for: .normal)
        var imageView : UIImageView?
        imageView = UIImageView(image: UIImage(named:imageName))
        imageView?.frame = CGRect(x: 5, y: 5, width: 25, height: 25)
        buttonSelect.addSubview(imageView!)
    }
}

License

JKDropDown is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "JKDropDown",
    "version": "1.0.4",
    "summary": "Ios Swift-3 lightweight DropDown using tableview",
    "description": "Ios Swift-3 lightweight DropDown using tableview!",
    "homepage": "https://github.com/janeshsutharios/JKDropDown",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Janesh suthar": "[email protected]"
    },
    "source": {
        "git": "https://github.com/janeshsutharios/JKDropDown.git",
        "tag": "1.0.4"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "JKDropDown/JKDropDown.swift",
    "pushed_with_swift_version": "3.0n3.0"
}

Pin It on Pinterest

Share This