Coder Social home page Coder Social logo

dropdown's Introduction

DropDown

Twitter: @kevinh6113 License: MIT Version Cocoapods Carthage compatible

A Material Design drop down for iOS written in Swift.


Demo

Do pod try DropDown in your console and run the project to try a demo. To install CocoaPods, run sudo gem install cocoapods in your console.

Installation πŸ“±

DropDown supports Swift 5.0 since version 2.3.13. DropDown supports Swift 4.2 since version 2.3.4.

If you need Swift 4.0, use version 2.3.2:

  • Manually: use tag 2.3.2
  • CocoaPods: pod 'DropDown', '2.3.2'
  • Carthage: github "AssistoLab/DropDown" == 2.3.2

CocoaPods

Use CocoaPods.

  1. Add pod 'DropDown' to your Podfile.
  2. Install the pod(s) by running pod install.
  3. Add import DropDown in the .swift files where you want to use it

Carthage

Use Carthage.

  1. Create a file name Cartfile.
  2. Add the line github "AssistoLab/DropDown".
  3. Run carthage update.
  4. Drag the built DropDown.framework into your Xcode project.

Source files

A regular way to use DropDown in your project would be using Embedded Framework. There are two approaches, using source code and adding submodule.

Add source code:

  1. Download the latest code version.
  2. Unzip the download file, copy DropDown folder to your project folder

Add submodule

  1. In your favorite terminal, cd into your top-level project directory, and entering the following command:
$ git submodule add [email protected]:AssistoLab/DropDown.git

After you get the source code either by adding it directly or using submodule, then do the following steps:

  • Open DropDown folder, and drag DropDown.xcodeproj into the file navigator of your app project, under you app project.
  • In Xcode, navigate to the target configuration window by clicking the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
  • Open "Build Phases" panel in the tab bar at the top of the window, expend the "Target Dependencies" group and add DropDown.framework under DropDown icon in the popup window by clicking +. Similarly, you can also add DropDown.framework in "Embedded Binaries" under "General" tab.

Basic usage ✨

let dropDown = DropDown()

// The view to which the drop down will appear on
dropDown.anchorView = view // UIView or UIBarButtonItem

// The list of items to display. Can be changed dynamically
dropDown.dataSource = ["Car", "Motorcycle", "Truck"]

Optional properties:

// Action triggered on selection
dropDown.selectionAction = { [unowned self] (index: Int, item: String) in
  print("Selected item: \(item) at index: \(index)")
}

// Will set a custom width instead of the anchor view width
dropDownLeft.width = 200

Display actions:

dropDown.show()
dropDown.hide()

Important ⚠️

Don't forget to put:

DropDown.startListeningToKeyboard()

in your AppDelegate's didFinishLaunching method so that the drop down will handle its display with the keyboard displayed even the first time a drop down is showed.

Advanced usage πŸ› 

Direction

The drop down can be shown below or above the anchor view with:

dropDown.direction = .any

With .any the drop down will try to displa itself below the anchor view when possible, otherwise above if there is more place than below. You can restrict the possible directions by using .top or .bottom.

Offset

By default, the drop down will be shown onto to anchor view. It will hide it. If you need the drop down to be below your anchor view when the direction of the drop down is .bottom, you can precise an offset like this:

// Top of drop down will be below the anchorView
dropDown.bottomOffset = CGPoint(x: 0, y:(dropDown.anchorView?.plainView.bounds.height)!)

If you set the drop down direction to .any or .top you can also precise the offset when the drop down will shown above like this:

// When drop down is displayed with `Direction.top`, it will be above the anchorView
dropDown.topOffset = CGPoint(x: 0, y:-(dropDown.anchorView?.plainView.bounds.height)!)

Note the minus sign here that is use to offset to the top.

Cell configuration

Formatted text

By default, the cells in the drop down have the dataSource values as text. If you want a custom formatted text for the cells, you can set cellConfiguration like this:

dropDown.cellConfiguration = { [unowned self] (index, item) in
  return "- \(item) (option \(index))"
}

Custom cell

You can also create your own custom cell, from your .xib file. To have something like this for example:

You can check out a concrete example in the Demo inside this project (go to ViewController.swift, line 125).

For this you have to:

class MyCell: DropDownCell {
   @IBOutlet weak var logoImageView: UIImageView!
}
  • Create your custom xib (e.g. MyCell.xib) and design your cell view in it
  • Link the cell in your xib to your custom class
  • At least have a label in your xib to link to the optionLabel IBOutlet in code (optionLabel is a property of DropDownCell)

  • Then, you simply need to do this:
let dropDown = DropDown()

// The view to which the drop down will appear on
dropDown.anchorView = view // UIView or UIBarButtonItem

// The list of items to display. Can be changed dynamically
dropDown.dataSource = ["Car", "Motorcycle", "Truck"]

/*** IMPORTANT PART FOR CUSTOM CELLS ***/
dropDown.cellNib = UINib(nibName: "MyCell", bundle: nil)

dropDown.customCellConfiguration = { (index: Index, item: String, cell: DropDownCell) -> Void in
   guard let cell = cell as? MyCell else { return }

   // Setup your custom UI components
   cell.logoImageView.image = UIImage(named: "logo_\(index)")
}
/*** END - IMPORTANT PART FOR CUSTOM CELLS ***/
  • And you're good to go! πŸ™†

For a complete example, don't hesitate to check the demo app and code.

Events

dropDown.cancelAction = { [unowned self] in
  println("Drop down dismissed")
}

dropDown.willShowAction = { [unowned self] in
  println("Drop down will show")
}

Dismiss modes

dropDown.dismissMode = .onTap

You have 3 dismiss mode with the DismissMode enum:

  • onTap: A tap oustide the drop down is needed to dismiss it (Default)
  • automatic: No tap is needed to dismiss the drop down. As soon as the user interact with anything else than the drop down, the drop down is dismissed
  • manual: The drop down can only be dismissed manually (in code)

Others

You can manually (pre)select a row with:

dropDown.selectRow(at: 3)

The data source is reloaded automatically when changing the dataSource property. If needed, you can reload the data source manually by doing:

dropDown.reloadAllComponents()

You can get info about the selected item at any time with this:

dropDown.selectedItem // String?
dropDown.indexForSelectedRow // Int?

Customize UI πŸ–Œ

You can customize these properties of the drop down:

  • textFont: the font of the text for each cells of the drop down.
  • textColor: the color of the text for each cells of the drop down.
  • selectedTextColor: the color of the text for selected cells of the drop down.
  • backgroundColor: the background color of the drop down.
  • selectionBackgroundColor: the background color of the selected cell in the drop down.
  • cellHeight: the height of the drop down cells.
  • dimmedBackgroundColor: the color of the background (behind the drop down, covering the entire screen).
  • cornerRadius: the corner radius of the drop down (see info below if you encounter any issue)
  • setupMaskedCorners: the masked corners of the dropdown. Use this along with cornerRadius to set the corner radius only on certain corners.

You can change them through each instance of DropDown or via UIAppearance like this for example:

DropDown.appearance().textColor = UIColor.black
DropDown.appearance().selectedTextColor = UIColor.red
DropDown.appearance().textFont = UIFont.systemFont(ofSize: 15)
DropDown.appearance().backgroundColor = UIColor.white
DropDown.appearance().selectionBackgroundColor = UIColor.lightGray
DropDown.appearance().cellHeight = 60

Expert mode πŸ€“

when calling the show method, it returns a tuple like this:

(canBeDisplayed: Bool, offscreenHeight: CGFloat?)
  • canBeDisplayed: Tells if there is enough height to display the drop down. If its value is false, the drop down is not showed.
  • offscreenHeight: If the drop down was not able to show all cells from the data source at once, offscreenHeight will contain the height needed to display all cells at once (without having to scroll through them). This can be used in a scroll view or table view to scroll enough before showing the drop down.

Issues

If you experience the compiler error "Ambiguous use of 'cornerRadius'" on line:

DropDown.appearance().cornerRadius = 10

Please use intead:

DropDown.appearance().setupCornerRadius(10) // available since v2.3.6

Requirements

  • Xcode 8+
  • Swift 3.0
  • iOS 8+
  • ARC

License

This project is under MIT license. For more information, see LICENSE file.

Credits

DropDown was inspired by the Material Design version of the Simple Menu.

DropDown was done to integrate in a project I work on:
Assisto

It will be updated when necessary and fixes will be done as soon as discovered to keep it up to date.

I work at
Pinch

You can find me on Twitter @kevinh6113.

Enjoy!

dropdown's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dropdown's Issues

Use dropdown in custom UIView

Hi, thank you for an awesome package
I want to implement Dropdown in my custom view. Something like this:

import UIKit
import DropDown

class FiltersView: UIView {
    var view: UIView!

    @IBOutlet weak var seeViewDropDown: UIView!
    @IBOutlet weak var sortViewDropDown: UIView!
    @IBOutlet weak var filterViewDropDown: UIView!

    override init(frame:CGRect) {

        super.init(frame: frame)
        setup()
    }

    required init?(coder aDecoder: NSCoder) {

        super.init(coder: aDecoder)
        setup()
    }

    func someAction(sender:UITapGestureRecognizer){

        let dropDown = DropDown()

        // The view to which the drop down will appear on
        dropDown.anchorView = seeViewDropDown // UIView or UIBarButtonItem

        // The list of items to display. Can be changed dynamically
        dropDown.dataSource = ["Car", "Motorcycle", "Truck"]

        dropDown.show()
    }

    func setup() {
        view = loadViewFromNib()
        view.frame = bounds
        addSubview(view)

        let gestureSwift2AndHigher = UITapGestureRecognizer(target: self, action:  #selector (self.someAction(sender:)))
        seeViewDropDown.addGestureRecognizer(gestureSwift2AndHigher)
    }

    func loadViewFromNib() -> UIView {
        let bundle = Bundle(for: type(of: self))
        let nib = UINib(nibName: "FiltersView", bundle: bundle)
        view = nib.instantiate(withOwner: self, options: nil)[0] as! UIView

        return view
    }

}

The target is that clicking on seeViewDropDown view to show dropdown. But when I click seeViewDropDown. This error happen:

screen shot 2016-09-29 at 18 15 52

I think I do something wrong but don't know where. Could you help me ?
Thank you.

change text color or font

Unable to change the text color or font in xcode 7.3.1, using DropDown.appearance().textColor does not work.

crash on updateConstraints()

Hi, I tried using this control to one of our apps and it crashes the app. I received this crash report. I have no clue what causing the crash. Hoping for any helps. Thank you.

screen shot 2016-07-18 at 10 37 39 am

Crashing at page load

Crashing at this point
/// Hides the drop down.
public func hide() {
if self == DropDown.VisibleDropDown {
/*
If one drop down is showed and another one is not
but we call hide() on the hidden one:
we don't want it to set the VisibleDropDown to nil.
*/
DropDown.VisibleDropDown = nil
}

    if hidden {
        return
    }

    UIView.animateWithDuration(
        animationduration,
        delay: 0,
        options: animationExitOptions,
        animations: { [unowned self] in
            self.setHiddentState()
        },
        completion: { [unowned self] finished in

//crashing on line below

                            self.hidden = true
            self.removeFromSuperview()
        })
}

Working with swift 2.2

I want to import DropDown to myProject with CocoaPod, i use swift 2.2. Who can help me?

The first table cell as the anchor view

I would like to set the first table cell as the anchor view.
My code:

dropDown.direction = .Bottom
        let indexPath = NSIndexPath(forRow: 0, inSection: 0)
        if let cell = self.tableView.cellForRowAtIndexPath(indexPath) as? DropDownShopTableViewCell {
            dropDown.anchorView = cell
            dropDown.bottomOffset = CGPoint(x: 0, y:(dropDown.anchorView?.plainView.bounds.height)!)
        }

But it doesn't work for me. Can you help me?

Crash error in Xcode8 swift3

it crashes if you directly use a local variable "let dropDown = DropDown()", rather than assigning dropDown as a property. However it works in Xcode7.3.

Multiple Sections in DropDown

Hi. I am trying to implement an autocomplete function inside the DropDown. I can't make it work because after the recalculation of the DataSource the cell are being created again and I am loosing my textField also. Can I somehow create multiple sections so that I can include one section with the static UITextField and one other with the datasource ? Thanks

Xib doesn't work in xcode 7.3 swift 2.2

notthing happen when i click button. The second time, when i click button dropDown.willShowAction work.

let dropDown = DropDown()
    var labelArr = ["Car", "Motorcycle"]
    var imageArr = ["logout.png","camera.png"]

    @IBAction func xzx(sender: AnyObject) {
        dropDown.anchorView = viewSetting
        //     dropDown.dataSource = labelArr
        DropDown.appearance().backgroundColor = UIColor.blackColor()
        //dropDown.direction = .Bottom
       // dropDown.bottomOffset = CGPoint(x: 0, y: self.viewSetting.bounds.height)
        dropDown.cellNib = UINib(nibName: "DropTableViewCell", bundle: nil)
        dropDown.customCellConfiguration = { (index: Index, item: String, cell: DropDownCell) -> Void in
            guard let cell = cell as? DropTableViewCell else { return }

            // Setup your custom UI components
            cell.optionLabel.text = self.labelArr[index]
            cell.imgIcon.image = UIImage(named: self.imageArr[index])
        }
        dropDown.show()
        dropDown.willShowAction = { [unowned self] in
            print("Drop down will show")
        }
    }

Help me pls :)

update DropDown

hi
i update DropDown from 1 to 1.5 but when running program app not working and error
"DropDown.DropDown.anchorView.setter : weak DropDown.AnchorView?", referenced from:

Undefined symbols for architecture x86_64:
  "DropDown.DropDown.anchorView.setter : weak DropDown.AnchorView?", referenced from:
      balen.AircraftSearch.viewDidLoad () -> () in AircraftSearch.o
  "protocol witness table for __ObjC.UIView : DropDown.AnchorView in DropDown", referenced from:
      balen.AircraftSearch.viewDidLoad () -> () in AircraftSearch.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Getting error after updating pod.

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users.../DropDown.framework> (loaded)' with name 'DropDownCell''

Make it even more material!

I am not quite sure about what this is called, but I think it's called material ripple effect or something...

At the moment, when someone taps on a drop down menu item, the menu item just darkens without any animation. But as you can see in the Youtube app, the menu items behave differently. The shade is animated. It first starts at where your finger is, then it quickly expands to fill the whole item.

To see the animation, open the Youtube iOS app on a phone, then tap the three dots on the top right corner. Then an action sheet kind of thing appears at the bottom of the screen. If you tap and hold one of the items, you will see the animation. The cool thing about this is that if you tap on the right of the item, the dark color will spread to the left. If you tap on the left, the dark color will spread to the right. And if you tap in the middle, the dark color spreads both sides.

Can you add this to the pod as well?

selected index didn't reset when reset dataSource

I'm very happy with this nice work,

however I need to change the dataSource dynamically, the crash happens when the selected index of last dataSource is out of the new one, for example

dataSource A: ["a,","b"]

then, user select "b", which is index of 1

then I set new dataSource B: ["alpha"]

then when user open the dropdown menu, crash, due to the selected index is out of B's range

hope it helps

Causes Problems with Alert View:

I used this in one view controller and it caused problems in another unrelated view controller when I clicked on an action in a alertviewcontroller.

It's nice but I had to remove it because of this :(

libswiftCore.dylib`swift_unknownUnownedLoadStrong:

    My App is crashing here line 485 in DropDown.swift . I cant figure out why . I am not using DropDown in viewcontroller it is crashing .

    dispatch_async(dispatch_get_main_queue()) { [unowned self] in
        self.tableView.flashScrollIndicators()
    }
    super.updateConstraints()

Add Icon to the rows

It is actually a request.
Could we add icons to the rows and have a property that aligns it to the .Left or .Right of the row?

Could not load NIB in bundle: 'NSBundle with name 'DropDownCell'

GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:48): Uncaught exception: Could not load NIB in bundle: 'NSBundle </Users/tuliothome/Library/Developer/Xcode/DerivedData/iOSFanfics-enerleptowspyagorhkcphtttefg/Build/Products/Debug-iphonesimulator/DropDown.framework> (loaded)' with name 'DropDownCell'

UIBarButtonItem for anchorView

Please support UIBarButtonItem for the anchorView.
For the moment, I use this:
dropDown.anchorView = self.navigationItem.rightBarButtonItem!.valueForKey("view") as! UIView

Thanks!

Custom Datasource

I think a possible enhancement for the future is to provide functionality to allow for a more flexible datasource. In my example, I have a custom cell, and want it backed by a list of View Models, and I am unsure of a clean way, with the current state of the project, to do this.

As of now, I'm using a dictionary, and using the keys as the datasource, and then inside of the customCellConfiguration, using the key to fetch the actual view model.

I would much prefer to be able to specify my datasource. If nothing else, simply making the datasource an array of some protocol which has a single display method (which returns a string) would be more flexible, and not entail a huge change.

Show Dropdown in objective-c

I tried but there error while using show method with dropdown object in objective-c.

how can i call show method for display dropdown in objective-c?

Cell height

How to change cell height (row height) in dropdown list?

Fix for shadowPath

Great component! Found this tiny little bug:

change line 390 in Dropdown.swift from
let shadowPath = UIBezierPath(rect: tableViewContainer.bounds)
to
let shadowPath = UIBezierPath(roundedRect: tableViewContainer.bounds,cornerRadius: DPDConstant.UI.CornerRadius)

dropdown direction is always top

Hi,

if I set direction to .Top or .Any dropdown popup appear at the top of UIButton which is anchor view. if i set to .Bottom nothing happens,

is it a bug or misusing?

dropDownMonth.anchorView = dropDownButtonMonth dropDownMonth.bottomOffset = CGPoint(x: 0, y: dropDownButtonMonth.bounds.height) dropDownMonth.direction = .Bottom

return item

how can i return selected item and save to other variable؟

Make DPDConstants public?

Your component is really well done!
Any chance that you migrate the values from DPDConstants into .appearance?
My workaround for now is to change all values in there from
internal let
to
public var
but I guess I am not the only one who needs to change the appearance of the dropdown.
Thanks! :)

Cell configuration with extra elements

I have to display a dropdown with a country selection list, which includes the country name, but also a phone prefix and a UIImage with the flag. I have used this component in other parts, so I tried to use it for this purpose, but I found it not possible. I suggest we (I could help) make some changes:

1.- Allow to customize the cell registered on the tableView. It could be by exposing a property to change the registered NIB.
Instead of

internal final class DropDownCell: UITableViewCell {

    //MARK: - Properties
    static let Nib = UINib(nibName: "DropDownCell", bundle: NSBundle(forClass: DropDownCell.self))

Do something like:

public final class DropDown: UIView {
        public var cellNib = UINib(nibName: "DropDownCell", bundle: NSBundle(forClass: DropDownCell.self)) {
                didSet {
                        tableView.registerNib(cellNib, forCellReuseIdentifier: DPDConstant.ReusableIdentifier.DropDownCell)
                        reloadAllComponents() 
                }
        }

2.- Add a block that allows the customization of the cell content, similar to the ConfigurationClosure but receiving the cell instead. For example:

public typealias CellConfigurationClosure = (Index, String, DropDownCell) -> Void

public final class DropDown: UIView {
    ....
    public var customCellConfiguration: CellConfigurationClosure? {
        didSet { reloadAllComponents() }
    }

which should be called from the table datasource like:

    public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
....
        customCellConfiguration?(index, dataSource[index], cell)
        return cell
    }

This way, someone could provide its own type of DropDownCell, but at the same time keep the current API for users not wanting that. This approach will also require to convert DropDownCell to public and remove the final

What do you think? Any better approach?

Installing for Xcode 8-beta 6 yields 135 syntax errors in attempt to convert

When using pods to install for Xcode 8-beta 6, there's errors saying to convert to swift 2.3 or swift 3.0. After following apple's walkthrough to convert it, there's still around 135 syntax errors.

Building the demo with Xcode 8 builds, but the simulator doesn't show up.

screen shot 2016-09-20 at 12 05 21 pm

Unsure if DropDown isn't intended to work with Xcode 8.

Flexible datasource

Hi, this pod can customise dropDown.dataSource for my own array without prefix the content of array?

DropDown frame is CGRectZero after calling show

Hi Kevin,

Thanks again for supporting this open source library. It's very well written in my opinion and I've had an easy time using it. I do have DropDown working successfully from Objective-C in one table view controller that is static-grouped and the first child of a navigation controller in a tabbar controller. Yesterday I attempted to add it a second view controller which is loaded dynamically and presented modally, which are the only differences that I can see between the uses of it.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    SQFBFriendTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:[SQFBFriendTableViewCell reuseIdentifier]];
    ... // some switching to detect the correct section, but the routing is correct

    self.multiplePhoneNumbersMenu = [[DropDown alloc] init];
    self.multiplePhoneNumbersMenu.textFont = [UIFont gothamBookAtSize:16];
    self.multiplePhoneNumbersMenu.textColor = [UIColor squadColorGrey103];
    self.multiplePhoneNumbersMenu.anchorView = cell;

     // this offset is from my implementation in the other tableview controller, toggling it has no effect on the issue
    CGFloat offset = self.multiplePhoneNumbersMenu.anchorView.plainView.bounds.size.height;
    self.multiplePhoneNumbersMenu.bottomOffset = CGPointMake(0, offset);
    self.multiplePhoneNumbersMenu.topOffset = CGPointMake(0, -offset);


    self.multiplePhoneNumbersMenu.dataSource = @[ @"Hello world" ];
    @weakify(self);
    self.multiplePhoneNumbersMenu.selectionAction = ^(NSInteger index, NSString * _Nonnull item) {
        @strongify(self);
        ... // does stuff
    };

    [self.multiplePhoneNumbersMenu show];
    // breakpoint here po's the frame as 0,0,0,0. the cell selection is highlighted, but the DropDown never appears
}
po self.multiplePhoneNumbersMenu
<DropDown.DropDown: 0x158641170; frame = (0 0; 0 0); alpha = 0; animations = { opacity=<CABasicAnimation: 0x1581db490>; }; layer = <CALayer: 0x1585247d0>>

I feel like I'm possibly missing something basic, but the implementation is mostly parallel to the one in my other class is the working. Any insight that you can offer would be appreciated. Thanks again!

~Mark

Attempted to retain deallocated object

I got this error whenever the view is about to be rendered.

_libswiftCore.dylib`swift_abortRetainUnowned:
0x1111def00 <+0>: leaq 0x2ae8c(%rip), %rax ; "attempted to retain deallocated object"
0x1111def07 <+7>: movq %rax, 0x6beaa(%rip) ; gCRAnnotations + 8
0x1111def0e <+14>: int3
-> 0x1111def0f <+15>: nop

It happens in DropDown.swift
dispatch_async(dispatch_get_main_queue()) { [unowned self] in
self.tableView.flashScrollIndicators()
}

Memory Leak in Demo

Just run the app and debug memory graph.
Memory leak in dataSource and selectionAction closure.

drop

Dismiss Keyboard?

Is there anyway to prevent the keyboard from showing up? If I'm giving the user a list of options, the keyboard is likely not needed.

I've tried textField.resignFirstResponder() but that doesn't work. Also tried some combinations with func textFieldDidBeginEditing(textField: UITextField) etc.

One suggestion would be to extend the dropdown functionality to UILabel. Any other suggestions appreciated.

Error in swift 3.0

I have an error in file: DropDown.swift in line 807 => self.isHidden = true

Select multiple items

Is there any way to select multiple items in a DropDown? So far as a workaround, I'm appending each selected item to another array. But after each selection the DropDown hides itself and the user needs to open it again. Kindly let me know if there's another way. Thanks!

Height of the pop up

Is it possible to set the height of the pop up?
i have 30 elements in the drop down, when the drop down is shown, it covers my whole screen.

Is there a way to display fixed height so that only a few item shown and user can scroll through it?

Swift 3

it'd be cool to have a swift 3 version, if you have any interest to create a branch i would like to help with that.

Target deployment compatibility Issue

Library description states that it should be compatible with projects for ios 7+, but im getting this error in an empty project when declaring the 'import DropDown'

.../ViewController.swift:10:8: Module file's minimum deployment target is ios9.2 v9.2: ../Build/Products/Debug-iphoneos/DropDown.framework/Modules/DropDown.swiftmodule/arm.swiftmodule

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.