hackiftekhar / IQDropDownTextField

TextField with DropDown support using UIPickerView
MIT License
309 stars 87 forks source link

Exists a way to show the done button? #40

Closed juancholt closed 8 years ago

juancholt commented 8 years ago

When the dropdown picker is shown the bar that goes over the picker view and haves a done button isnt showing, exists any sort of method to show that like the image you've posted?

hackiftekhar commented 8 years ago

Actually it's developer responsibility add add a toolbar with done button above picker. You can compare this issue with the native iOS keyboard problem. When a keyboard up and there is developer responsibility to dismiss keyboard when return button is pressed.

svbalamuruga commented 7 years ago

fileprivate lazy var allTextFields: [IQDropDownTextField] = { let allTextFields: [IQDropDownTextField] = [ self.header_style ] return allTextFields }() override func viewDidLoad() { super.viewDidLoad()

        let flexibleButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
        let doneButton = UIBarButtonItem(title: "Done", style: .plain, target: self, action: #selector(doneClicked(_:)))
        let toolbar = UIToolbar()
        toolbar.items = [flexibleButton, doneButton]
        toolbar.sizeToFit()

        self.allTextFields.forEach { (textField) in
            textField.inputAccessoryView = toolbar
        }