diff options
author | Eric Kuck <eric@bluelinelabs.com> | 2018-12-12 21:16:28 -0600 |
---|---|---|
committer | Eric Kuck <eric@bluelinelabs.com> | 2018-12-12 21:16:28 -0600 |
commit | 4eec53d6d3d5290b431737f5899a53b66118bfd3 (patch) | |
tree | 460ff5cbb9e70f3527d39192f620dae7e2c4c739 /WireGuard | |
parent | More formatting nits and cyclomatic complexity fixes (diff) | |
download | wireguard-apple-4eec53d6d3d5290b431737f5899a53b66118bfd3.tar.xz wireguard-apple-4eec53d6d3d5290b431737f5899a53b66118bfd3.zip |
Fixed hacky logo display for settings
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to 'WireGuard')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift index 8f248c9..346f66d 100644 --- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift @@ -43,10 +43,16 @@ class SettingsTableViewController: UITableViewController { self.tableView.register(KeyValueCell.self) self.tableView.register(ButtonCell.self) - let logo = UIImageView(image: UIImage(named: "wireguard.pdf", in: Bundle.main, compatibleWith: nil)!) + let image = UIImage(named: "wireguard.pdf")! + let logo = UIImageView(image: image) logo.contentMode = .scaleAspectFit - let height = self.tableView.rowHeight * 1.5 - let width = height * logo.image!.size.width / logo.image!.size.height + var height = self.tableView.estimatedRowHeight * 1.5 + var width = height * image.size.width / image.size.height + let minScreenDimension = min(UIScreen.main.bounds.size.width, UIScreen.main.bounds.size.height) + if width > minScreenDimension - 30 { + width = minScreenDimension - 30 + height = width * image.size.height / image.size.width + } logo.frame = CGRect(x: 0, y: 0, width: width, height: height) logo.bounds = logo.frame.insetBy(dx: 2, dy: 2) self.tableView.tableFooterView = logo |