This commit is contained in:
Kevin G Christiano 2019-11-18 15:40:11 -05:00
parent 9b581a6132
commit 1d08842d47
3 changed files with 21 additions and 9 deletions

View File

@ -103,5 +103,7 @@ extension DateDropdownEntryField {
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
guard let dictionary = json, !dictionary.isEmpty else { return }
}
}

View File

@ -306,10 +306,10 @@ import UIKit
return enabledTextFields
}
//--------------------------------------------------
// MARK: - Text Field Delegate
//--------------------------------------------------
}
// MARK: - TextField Delegate
extension DigitEntryField {
@objc public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
@ -381,10 +381,6 @@ import UIKit
return uiTextFieldDelegate?.textFieldShouldClear?(textField) ?? true
}
//--------------------------------------------------
// MARK: - Passed Along TextField delegate
//--------------------------------------------------
@objc public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
return uiTextFieldDelegate?.textFieldShouldBeginEditing?(textField) ?? true

View File

@ -42,10 +42,20 @@ open class ItemDropdownEntryField: DropdownEntryField {
// MARK: - Initializer
//--------------------------------------------------
public convenience init() {
self.init(frame: .zero)
setup()
}
public convenience init(pickerData: [String]) {
self.init(frame: .zero)
self.pickerData = pickerData
setup()
}
private func setup() {
pickerView = MVMCoreUICommonViewsUtility.addPicker(to: textField, delegate: self)
textField.hideBlinkingCaret = true
uiTextFieldDelegate = self
@ -55,7 +65,7 @@ open class ItemDropdownEntryField: DropdownEntryField {
// MARK: - Methods
//--------------------------------------------------
public func setPickerDelegate(delegate: UIPickerViewDelegate & UIPickerViewDataSource) {
public func setPickerDelegates(delegate: UIPickerViewDelegate & UIPickerViewDataSource) {
pickerView?.delegate = delegate
pickerView?.dataSource = delegate
@ -102,6 +112,10 @@ extension ItemDropdownEntryField {
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
guard let dictionary = json, !dictionary.isEmpty else { return }
if let options = dictionary["options"] as? [String] {
pickerData = options
}
}
}