Skip to content
Simple DropDown framework ...
Swift Ruby
Branch: master
Clone or download
Latest commit e0042ad Sep 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Demo1
SBDropDown.xcodeproj Code cleaned.. Sep 18, 2019
SBDropDown Code cleaned.. Sep 18, 2019
.DS_Store Bug fixes with improvement.... Sep 15, 2019
.swift-version First Commit ----- Aug 8, 2019
LICENSE Add files via upload Aug 8, 2019
Podfile First Commit ----- Aug 8, 2019
README.md Update README.md Sep 18, 2019
SBDropDown.podspec
Screenshot 2019-08-20 at 11.20.24 PM.png Bug fixes and readme updated..... and new screen shot updated... Aug 20, 2019
UpdateLog.md Bug fixes with improvement.... Sep 15, 2019

README.md

SBDropDown

Simple dropDown for date and _ array. Pod Link

 pod 'SBDropDown'

One More Note:- Doc is not updated for version 0.1.0 😑😐😐

Video Link 1

Version History

Usage

Sample1

Custom Text DropDown

  1. To show DropDown with respect with to sourceView and sourceRect (optional)
    self.showSBDropDown(strTitle: "My Title", arrSelectedIndex: [2], arrElemets: ["Value 1", "Value 2", "Value 3"], sourceView: sender, key: "myKey")

where,

  • strTitle :- Is the title of dropDown list.
  • arrElemets :- Array of you normal or complicated model.
  • arrSelectedIndex :- Array of your selected indices if any else set [].
  • sourceView :- DropDown arrow is pointing to this view and you haven't provided sourceRect then sourceView.bounds is used instead of this
  • key :- Extra key if that you may want it for differentiate from others
  1. After this you have to define delegate methods for SBProtocol which are already confirmed at start.
    configCellFor(currentIndex: Int, arrSelectedIndex: [Int], currentData: Any, cell: SBTableCell, key: Any?)

If you provide array of string then no need to set this. I have done your work for that😅. where,

  • currentIndex :- As name say's it is current Index 😜
  • arrSelectedIndex :- As this framework is also support for multi selection. So that it that it has multiple selected indices.
  • currentData :- Object that you are using to set on dropDrown.
  • cell :- Table view cell of class SBTableCell is for data set with you custom check mark icon and to change alignment of lable.
  • key :- Extra key if that you may want it for differentiate from others

For Example,

    // MARK:- Extension for SBTableProtocol
    extension ViewController: SBTableProtocol {
        func configCellFor(currentIndex: Int, arrSelectedIndex: [Int], currentData: Any, cell: SBTableCell, key: Any?) {
            if let str = currentData as? String {
                cell.lblTitle.text = str
                cell.imgvCheckMark.image = arrSelectedIndex.contains(currentIndex) ? #imageLiteral(resourceName: "blueCheck") : nil
                cell.imgvCheckMark.isHidden = cell.imgvCheckMark.image == nil
            }
        }
        
     ....
     
    } //extension

Now the second method is

    didSelectCell(currentIndex: Int, arrSelectedIndex: [Int], currentData: Any, key: Any?)

where,

  • currentIndex :- As name say's it is current Index 😜

  • arrSelectedIndex :- As this framework is also support for multi selection. So that it that it has multiple selected indices.

  • currentData :- Object that you are using to set on dropDrown.

  • key :- Extra key if that you may want it for differentiate from others

    This methods is called when user tap on any dropDown list this method is triggerd like table view didSelect methods

And the last dropDown delegate methods is

    btnSelectSBProtocolPressed(arrSelectedIndex: [Int], arrElements: [Any], key: Any?)

where,

  • arrSelectedIndex :- As this framework is also support for multi selection. So that it that it has multiple selected indices.

  • arrElemets :- Array of you normal or complicated model which you send at start.

  • key :- Extra key if that you may want it for differentiate from others

    This methods is called when user tap's on select button.

  1. (Optional) Drop down Arrow Direction
    You can change drop down arrow direction as below,
    SBDropDown.shared.arrowDirection = .down

or

    SBDropDown.shared.arrowDirection = [.up, .down]
  1. (Optional) Select Button Properties...
    To show or hide SBDropDown.shared.isShowSelectButton = true // false. To change titile SBDropDown.shared.strSelectBtnTitle = "My New Title". To change width SBDropDown.shared.cgSelectButtonWidth = 180. To change or title color SBDropDown.shared.selectBtnColor = UIColor.blue. To change or background color SBDropDown.shared.selectBGBtnColor = UIColor.white.

  2. Selecetion type (Default is Multi Selection): To change this you need to set SBDropDown.shared.isMultiSelect = true // false

  3. To disable on double tap set SBDropDown.shared.isClearOnDoubleTab = false

Date & Time DropDown

  1. And you are ready to use it date and time drop down as below,
    self.showDatePicker(sourceView: sender)

or

    self.showSBDatePicker(strTitle: "Select DOB", currentDate: Date(), minDate: nil, maxDate: nil, sourceView: sender, sourceRect: sender.bounds)
  1. You can also modify time and date format that show on dropDown segment... like
    SBDropDown.shared.strTimeFormatter = "HH:mm a" 
    SBDropDown.shared.strDateFormatter = "dd-MM-yyyy"

And above format is default 😅.

  1. There are 3 delegate methods for protocol SBDateProtocol as below,
    didSBDateValueChanged(date: Date)

this gives when user change date picker value.

    btnSBSelectPressed(date: Date)

this methods called when user taps on Select btn.

    btnSBSelectDateOption(type: SBDateEnum)

this methods returns when user taps on data, time ordatetime as well

NOTE:- In demo app pod is removed so please install it before use.. Thanks😀 Again

HaPPy😃 to HeAr🤔 fRom yoU...😁....

You can’t perform that action at this time.