forked from zelo72/mastodon-ios
feat: make server search text field handle return key
This commit is contained in:
parent
3ab78f1134
commit
7115951f6b
|
@ -52,6 +52,7 @@ class PickServerSearchCell: UITableViewCell {
|
||||||
textField.clearButtonMode = .whileEditing
|
textField.clearButtonMode = .whileEditing
|
||||||
textField.autocapitalizationType = .none
|
textField.autocapitalizationType = .none
|
||||||
textField.autocorrectionType = .no
|
textField.autocorrectionType = .no
|
||||||
|
textField.returnKeyType = .done
|
||||||
return textField
|
return textField
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -78,6 +79,7 @@ extension PickServerSearchCell {
|
||||||
backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
|
backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
|
||||||
|
|
||||||
searchTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
|
searchTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
|
||||||
|
searchTextField.delegate = self
|
||||||
|
|
||||||
contentView.addSubview(bgView)
|
contentView.addSubview(bgView)
|
||||||
contentView.addSubview(textFieldBgView)
|
contentView.addSubview(textFieldBgView)
|
||||||
|
@ -107,3 +109,12 @@ extension PickServerSearchCell {
|
||||||
delegate?.pickServerSearchCell(self, searchTextDidChange: textField.text)
|
delegate?.pickServerSearchCell(self, searchTextDidChange: textField.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - UITextFieldDelegate
|
||||||
|
extension PickServerSearchCell: UITextFieldDelegate {
|
||||||
|
|
||||||
|
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||||
|
textField.resignFirstResponder()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue