GithubHelp home page GithubHelp logo

m760622 / uidropdowntextfield Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heshantha-md/uidropdowntextfield

0.0 2.0 0.0 1.12 MB

UIDropDownTextField is a custom class that written to draw / design an awesome Data Picker Controller with simple and easy approach. Developer can implement New Drop Down TextField with simple few steps and customize it with plenty of attributes using attributes inspector such as background, border color, separator color, font and font color etc. Class is based on Swift language and require UIKit framework for function the functionalities of the class.

License: MIT License

Swift 100.00%

uidropdowntextfield's Introduction

UIDropDownTextField

UIDropDownTextField is a custom class that written to draw / design an awesome Data Picker Controller with simple and easy approach. Developer can implement new Drop Down TextField with simple few steps and customize it with plenty of attributes using attributes inspector such as background, border color, separator color, font and font color etc. Class is based on Swift language and require UIKit framework for function the functionalities of the class.


To use UIDropDownTextField in your project, please follow following steps

  1. Add (or Drag and drop to Your project in Xcode) UIDropDownTextField.swift files to your project

  2. Add UIDropDownTextFieldDelegate to your ViewController class

    Ex:

       class ViewController: UIViewController, UIDropDownTextFieldDelegate
    
  3. Declaring and initializing a IBOutlet UIDropDownTextField so an UITextField can hook from interface

    Ex:

       @IBOutlet var dropTextField: UIDropDownTextField!
    
  4. Declaring and initializing an empty UIDropDownObject array so later can set drop down items from UIDropDownTextFieldDelegate datasource

    Ex:

       var socialMediaList: [UIDropDownObject] = [UIDropDownObject]()
    
  5. Assign UIDropDownTextField class to your UITextField from Identity Inspector class -> Custom Class section in XCode



  1. Assign UIDropDownTextFieldDelegate to UIDropDownTextField instance at your ViewController class

    Ex:

       override func viewDidLoad() 
       {
                 dropTextField.dropDownDelegate = self  
       }
    
  2. Add UIDropDownTextFieldDelegate datasource functions into your ViewController calss so you can catch set menu datasource to your UIDropDownTextField

    Ex:

       func dropDownTextField(_ dropDownTextField: UIDropDownTextField, didSelectRowAt indexPath: IndexPath) 
       {
                 let aDropDownObject: UIDropDownObject = socialMediaList[indexPath.row];
                 print("Great! You just select \(aDropDownObject.title) from UIDropDownTextField.")
           
                 // Or
           
                 print("Great! You can get selected text of \(dropTextField.text()) from UIDropDownTextField.")
                 print("Great! You can get selected value of \(dropTextField.value()) from UIDropDownTextField.")
       }
       
       // Mark - Initializing drop down items in UIDropDownTextField datasource
       
       func dropDownTextField(_ dropDownTextField: UIDropDownTextField, setOfItemsInDropDownMenu items: [UIDropDownObject]) -> [UIDropDownObject] 
       {
                 return socialMediaList
       }
    
  3. Initializing a new UIDropDownObject with object using previous UIDropDownObject variable

    Ex:

       override func viewDidLoad() 
       {
               let facebook = UIDropDownObject(title: "Facebook", value: "Facebook", icon: UIImage.init(named: "ic_facebook"))
               
               let linkedin = UIDropDownObject(title: "Linked in", value: "Linked in", icon: UIImage.init(named: "ic_linkedin"))
               
               
               socialMediaList = [facebook,linkedin]
       }
    
  4. Use IBInspectable properties to customize your awesome UIDropDownTextField at Attribute Inspector panel in XCode



Created by Nadeeshan Jayawardana (NEngineering).

uidropdowntextfield's People

Contributors

heshantha-md avatar

Watchers

James Cloos avatar Mohammed Abunada 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.