added focused state
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
84314040d9
commit
2f6df89f09
@ -31,6 +31,18 @@ open class DropdownSelect: EntryFieldBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// Override UIControl state to add the .error state if showSuccess is true and if showError is true.
|
||||||
|
open override var state: UIControl.State {
|
||||||
|
get {
|
||||||
|
var state = super.state
|
||||||
|
if dropdownField.isFirstResponder {
|
||||||
|
state.insert(.focused)
|
||||||
|
}
|
||||||
|
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// If true, the label will be displayed inside the dropdown containerView. Otherwise, the label will be above the dropdown containerView like a normal text input.
|
/// If true, the label will be displayed inside the dropdown containerView. Otherwise, the label will be above the dropdown containerView like a normal text input.
|
||||||
open var showInlineLabel: Bool = false { didSet { setNeedsUpdate() }}
|
open var showInlineLabel: Bool = false { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
@ -339,6 +351,14 @@ open class DropdownSelect: EntryFieldBase {
|
|||||||
titleLabelWidthConstraint?.isActive = helperTextPlacement == .right
|
titleLabelWidthConstraint?.isActive = helperTextPlacement == .right
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override var canBecomeFirstResponder: Bool { true }
|
||||||
|
|
||||||
|
open override func resignFirstResponder() -> Bool {
|
||||||
|
if dropdownField.isFirstResponder {
|
||||||
|
dropdownField.resignFirstResponder()
|
||||||
|
}
|
||||||
|
return super.resignFirstResponder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -354,6 +374,7 @@ extension DropdownSelect: UIPickerViewDelegate, UIPickerViewDataSource {
|
|||||||
dropdownField.resignFirstResponder()
|
dropdownField.resignFirstResponder()
|
||||||
}
|
}
|
||||||
optionsPicker.isHidden = !optionsPicker.isHidden
|
optionsPicker.isHidden = !optionsPicker.isHidden
|
||||||
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func numberOfComponents(in pickerView: UIPickerView) -> Int {
|
public func numberOfComponents(in pickerView: UIPickerView) -> Int {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user