Giter Club home page Giter Club logo

tddropdownlist's Introduction

TDDropdownList

Customizable dropdown list for iOS. Written in swift3.

##Installation ###CocoaPods

pod 'TDDropdownList'

###Manually Drag TDDropdownList.swift file into your project structure

##Usage

import UIKit
import TDDropdownList

class ViewController: UIViewController , TDDropdownListDelegate {

let list = TDDropdownList(frame: CGRect(x:60 , y : 100 , width: 200 , height: 50))
override func viewDidLoad() {
    list.initialize(data: ["Github","Theduman","Dropdown","List"])
    list.delegate = self
    self.view.addSubview(list)
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
func listTapped(sender: UIButton) {
    let alert = UIAlertController(title: "TDDropdownList" ,message: "Selected item: \(sender.currentTitle!)", preferredStyle:.alert)
    alert.addAction(UIAlertAction(title:"OK", style: .default, handler:nil))
    self.present(alert, animated: true, completion: nil)
}
}

You need to conform TDDropdownListDelegate to get the selected item of dropdown list.

Pass the string array to initialize() function that you want to show.

##Customization

initialize(data: [String],selectedItemColor: UIColor = UIColor(red:0.74, green:0.03, blue:0.11, alpha:1.00),itemColor:UIColor = UIColor(red:0.03, green:0.30, blue:0.53, alpha:1.00),textColor: UIColor = .white,selectedItemPlaceholder:String = "\u{02304}" , animationTimer: Double = 0.5)

In the initialize() function you can customize the UI of the library.

You can;

  • Change the background color of selected item using selectedItemColor: UIColor parameter
  • Change the background color of extended items using itemColor:UIColor parameter
  • Change the text color using textColor: UIColor
  • Change the placeholder of the selected item for the first time running using selectedItemPlaceholder:String.You can also provide Unicode characters.
  • Chance the animation time of expanding using animationTimer: Double parameter

tddropdownlist's People

Contributors

theduman avatar

Watchers

 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.