aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2020-12-23 16:03:01 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-12-23 16:14:03 +0100
commit491301f58b7c6746b5c694f9c7932d6d3c138c56 (patch)
treefa2cf215e951c1bfacaf096f73288d8624cc88bd
parentApp: version bump (diff)
downloadwireguard-apple-491301f58b7c6746b5c694f9c7932d6d3c138c56.tar.xz
wireguard-apple-491301f58b7c6746b5c694f9c7932d6d3c138c56.zip
UI: iOS: Fix placeholder label alignment in text fields.
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
-rw-r--r--Sources/WireGuardApp/UI/iOS/View/KeyValueCell.swift9
1 files changed, 8 insertions, 1 deletions
diff --git a/Sources/WireGuardApp/UI/iOS/View/KeyValueCell.swift b/Sources/WireGuardApp/UI/iOS/View/KeyValueCell.swift
index f99e3ea..70b97c8 100644
--- a/Sources/WireGuardApp/UI/iOS/View/KeyValueCell.swift
+++ b/Sources/WireGuardApp/UI/iOS/View/KeyValueCell.swift
@@ -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)
+ }
+}