diff options
author | Roopesh Chander <roop@roopc.net> | 2018-10-22 13:49:21 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-10-27 15:13:01 +0530 |
commit | 1a534faa0a0cce26c61bc9ed99491e0415fd7b62 (patch) | |
tree | 54a92c16c96c75d5d4648f790f68f0c153464ea9 /WireGuard/WireGuard/UI | |
parent | Tunnel creation: Start off with tunnel creation (diff) | |
download | wireguard-apple-1a534faa0a0cce26c61bc9ed99491e0415fd7b62.tar.xz wireguard-apple-1a534faa0a0cce26c61bc9ed99491e0415fd7b62.zip |
Tunnel creation: Fix Persistent Keepalive label's look
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift index c075faa..9b9ba98 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift @@ -225,7 +225,6 @@ extension TunnelEditTableViewController { case .endpoint: break case .persistentKeepAlive: - cell.hasLongKey = true break case .allowedIPs: break @@ -320,16 +319,6 @@ class TunnelsEditTableViewKeyValueCell: UITableViewCell { keyLabel.textColor = value ? UIColor.black : UIColor.gray } } - var hasLongKey: Bool { - get { return modifiableWidthRatioConstraint!.constant > 0 } - set(value) { - if (value) { - modifiableWidthRatioConstraint!.constant = 40 - } else { - modifiableWidthRatioConstraint!.constant = 0 - } - } - } var isValueValid: Bool = true { didSet(value) { if (value) { @@ -342,7 +331,6 @@ class TunnelsEditTableViewKeyValueCell: UITableViewCell { let keyLabel: UILabel let valueTextField: UITextField - private var modifiableWidthRatioConstraint: NSLayoutConstraint? = nil override init(style: UITableViewCellStyle, reuseIdentifier: String?) { keyLabel = UILabel() @@ -355,12 +343,15 @@ class TunnelsEditTableViewKeyValueCell: UITableViewCell { relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.4, constant: 0) + // The "Persistent Keepalive" key doesn't fit into 0.4 * width on the iPhone SE, + // so set a CR priority > the 0.4-constraint's priority. + widthRatioConstraint.priority = .defaultHigh + 1 + keyLabel.setContentCompressionResistancePriority(.defaultHigh + 2, for: .horizontal) NSLayoutConstraint.activate([ keyLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), keyLabel.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: 8), widthRatioConstraint ]) - modifiableWidthRatioConstraint = widthRatioConstraint contentView.addSubview(valueTextField) valueTextField.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ @@ -380,7 +371,6 @@ class TunnelsEditTableViewKeyValueCell: UITableViewCell { value = "" placeholderText = "" isValueEditable = true - hasLongKey = false isValueValid = true } } |