diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2020-07-15 17:18:17 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2020-07-15 18:12:28 +0200 |
| commit | 61b3d05236c2cd5f4c93eddd4f20291454bb8592 (patch) | |
| tree | 2f1403e1390cd3fc1caccd1c46b09116415b4e7e | |
| parent | 1042fbdf4dda6f0339156bd8b73c659b1421d323 (diff) | |
| download | mullvadvpn-61b3d05236c2cd5f4c93eddd4f20291454bb8592.tar.xz mullvadvpn-61b3d05236c2cd5f4c93eddd4f20291454bb8592.zip | |
Inherit ConnectonPanelCollapseButton from CustomButton
| -rw-r--r-- | ios/MullvadVPN/ConnectionPanelView.swift | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/ios/MullvadVPN/ConnectionPanelView.swift b/ios/MullvadVPN/ConnectionPanelView.swift index e9d5da93c3..fbf0ae44d3 100644 --- a/ios/MullvadVPN/ConnectionPanelView.swift +++ b/ios/MullvadVPN/ConnectionPanelView.swift @@ -177,7 +177,7 @@ class ConnectionPanelAddressRow: UIView { } } -class ConnectionPanelCollapseButton: UIButton { +class ConnectionPanelCollapseButton: CustomButton { enum Style { case up, down @@ -200,43 +200,28 @@ class ConnectionPanelCollapseButton: UIButton { override init(frame: CGRect) { super.init(frame: frame) - commonInit() - updateButtonImage() } required init?(coder: NSCoder) { super.init(coder: coder) - commonInit() - updateButtonImage() } private func commonInit() { setTitleColor(UIColor.white, for: .normal) setTitleColor(UIColor.lightGray, for: .highlighted) setTitleColor(UIColor.lightGray, for: .disabled) - } - private func updateButtonImage() { - setImage(style.image, for: .normal) - } + contentHorizontalAlignment = .leading + imageAlignment = .trailing + inlineImageSpacing = 0 - override func imageRect(forContentRect contentRect: CGRect) -> CGRect { - let titleRect = self.titleRect(forContentRect: contentRect) - var imageRect = super.imageRect(forContentRect: contentRect) - - imageRect.origin.x = titleRect.maxX - - return imageRect + updateButtonImage() } - override func titleRect(forContentRect contentRect: CGRect) -> CGRect { - var titleRect = super.titleRect(forContentRect: contentRect) - - titleRect.origin.x = 0 - - return titleRect + private func updateButtonImage() { + setImage(style.image, for: .normal) } } |
