diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-11-04 03:37:09 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-11-04 03:37:18 +0100 |
commit | 897c873296633472662cfcacd825599e854c3214 (patch) | |
tree | 2fa7dadae87498ed8dc931246f667ad509092351 /WireGuard/WireGuard | |
parent | Add a correct launch-screen storyboard (diff) | |
download | wireguard-apple-897c873296633472662cfcacd825599e854c3214.tar.xz wireguard-apple-897c873296633472662cfcacd825599e854c3214.zip |
Settings: anchor logo to bottom
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift index 09b0d77..badb571 100644 --- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift @@ -42,10 +42,21 @@ class SettingsTableViewController: UITableViewController { let logo = UIImageView(image: UIImage(named: "wireguard.pdf", in: Bundle.main, compatibleWith: nil)!) logo.contentMode = .scaleAspectFit - //TODO(roopesh): limit size to 1.5 * rowheight, and anchor to bottom + let height = self.tableView.rowHeight * 1.5 + let width = height * logo.image!.size.width / logo.image!.size.height + logo.frame = CGRect(x: 0, y: 0, width: width, height: height) + logo.bounds = logo.frame.insetBy(dx: 2, dy: 2) self.tableView.tableFooterView = logo } + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + guard let logo = self.tableView.tableFooterView else { return } + let fullHeight = max(self.tableView.contentSize.height, self.tableView.bounds.size.height - self.tableView.layoutMargins.top) + let e = logo.frame + let padding = CGFloat(10) + logo.frame = CGRect(x: e.minX, y: fullHeight - e.height - padding, width: e.width, height: e.height) + } @objc func doneTapped() { dismiss(animated: true, completion: nil) |