UI: iOS: Fix placeholder label alignment in text fields.
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
This commit is contained in:
parent
c4f79beb8d
commit
491301f58b
|
@ -27,7 +27,7 @@ class KeyValueCell: UITableViewCell {
|
|||
}()
|
||||
|
||||
let valueTextField: UITextField = {
|
||||
let valueTextField = UITextField()
|
||||
let valueTextField = KeyValueCellTextField()
|
||||
valueTextField.textAlignment = .right
|
||||
valueTextField.isEnabled = false
|
||||
valueTextField.font = UIFont.preferredFont(forTextStyle: .body)
|
||||
|
@ -234,3 +234,10 @@ extension KeyValueCell: UITextFieldDelegate {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class KeyValueCellTextField: UITextField {
|
||||
override func placeholderRect(forBounds bounds: CGRect) -> CGRect {
|
||||
// UIKit renders the placeholder label 0.5pt higher
|
||||
return super.placeholderRect(forBounds: bounds).integral.offsetBy(dx: 0, dy: -0.5)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue