SkyFloatingLabelTextField
SkyFloatingLabelTextField copied to clipboard
Title stay in selected style when the keyboard is dismissed interactively
In my case I have a UITableViewCell
subclass that contains a SkyFloatingLabelTextField
.
The UITableView
is configured in interactive mode for the keyboard dismiss self.tableView.keyboardDismissMode = .Interactive
.
When I do while having a textfield focused, the title keep the "selected style" even though I'm not editing anymore.
Thanks for your help!
After few more tests it occurs that this bug only happens when you dismiss the keyboard with the first touch on the text field and drag down from that point.
Once the text field is in that state, it's not possible to go back to the normal state, the title stay selected even if I dismiss the keyboard without touching the text field.
I don't know if the use case is clear enough, if not I'll try to add a sample project and gif.
I was facing a similar issue and solved it by setting highlighted = false
on resignFirstResponder()
:
class CustomTextField: SkyFloatingLabelTextField {
override func resignFirstResponder() -> Bool {
let result = super.resignFirstResponder()
if result {
highlighted = false
}
return result
}
}
+1
@jakunico This doesn't fix it. This help to remove highlight state, but sometimes, title stay highlighted.
I am seeing an issue where I have SkyFloatingLabelTextField's on a UITableViewCell and while clicking and dragging to scroll the tableview over other cells seems to somehow set the highlighted state on the textfields (maybe its an issue in cell reuse). I've tried resetting highlighted state but this seems to come later that when I can inject/change it. Selecting the text field and deselecting doesn't seem to get it out of the highlighted state. I'm not sure where to proceed but there seems to be some issues using highlighted.
Same thing happening here, i have a view with 4 textfields, if i start filling them by tapping on the first one and proceeding trough them by the keyboard next button, just the one that i tapped stays with the selection color, the rest turns back to the normal color. After analyzing, i realized that only the fields that you tap stays with the selection color after populated, if you populate a field by getting to it trough the next button, the selection color does not stick to it.
Managed to fix by setting highlighted on viewdidload
textField.isHighlighted = true