summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
Diffstat (limited to 'ios')
-rw-r--r--ios/MullvadVPN/AppButton.swift19
-rw-r--r--ios/MullvadVPN/ConnectMainContentView.swift2
-rw-r--r--ios/MullvadVPN/DisconnectSplitButton.swift1
3 files changed, 9 insertions, 13 deletions
diff --git a/ios/MullvadVPN/AppButton.swift b/ios/MullvadVPN/AppButton.swift
index 8636c667ee..799c4b933f 100644
--- a/ios/MullvadVPN/AppButton.swift
+++ b/ios/MullvadVPN/AppButton.swift
@@ -62,23 +62,22 @@ private extension UIControl.State {
commonInit()
}
- override func setTitle(_ title: String?, for state: UIControl.State) {
- if let title = title {
- setAttributedTitle(makeAttributedTitle(title, for: state), for: state)
- } else {
- setAttributedTitle(nil, for: state)
+ var titleString: String? {
+ didSet {
+ updateAttributedTitle(string: titleString)
}
}
private func commonInit() {
imageAlignment = .trailing
+ contentHorizontalAlignment = .leading
+ }
+ private func updateAttributedTitle(string: String?) {
let states: [UIControl.State] = [.normal, .highlighted, .disabled]
states.forEach { (state) in
- if let title = self.title(for: state) {
- let attributedTitle = makeAttributedTitle(title, for: state)
- self.setAttributedTitle(attributedTitle, for: state)
- }
+ let attributedTitle = string.flatMap { makeAttributedTitle($0, for: state) }
+ self.setAttributedTitle(attributedTitle, for: state)
}
}
@@ -197,7 +196,7 @@ private extension UIControl.State {
contentEdgeInsets = contentInsets
imageAlignment = .trailingFixed
- titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .semibold)
+ titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
let states: [UIControl.State] = [.normal, .highlighted, .disabled]
states.forEach { (state) in
diff --git a/ios/MullvadVPN/ConnectMainContentView.swift b/ios/MullvadVPN/ConnectMainContentView.swift
index a92d18fdda..57fbf13a2d 100644
--- a/ios/MullvadVPN/ConnectMainContentView.swift
+++ b/ios/MullvadVPN/ConnectMainContentView.swift
@@ -36,7 +36,6 @@ class ConnectMainContentView: UIView {
lazy var connectButton: AppButton = {
let button = AppButton(style: .success)
button.translatesAutoresizingMaskIntoConstraints = false
- button.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
return button
}()
@@ -44,7 +43,6 @@ class ConnectMainContentView: UIView {
let button = AppButton(style: .translucentNeutral)
button.accessibilityIdentifier = "SelectLocationButton"
button.translatesAutoresizingMaskIntoConstraints = false
- button.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
return button
}()
diff --git a/ios/MullvadVPN/DisconnectSplitButton.swift b/ios/MullvadVPN/DisconnectSplitButton.swift
index be3340d3ce..b3eaa5bcfc 100644
--- a/ios/MullvadVPN/DisconnectSplitButton.swift
+++ b/ios/MullvadVPN/DisconnectSplitButton.swift
@@ -39,7 +39,6 @@ class DisconnectSplitButton: UIView {
stackView.alignment = .fill
stackView.spacing = 1
- primaryButton.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
secondaryButton.setImage(UIImage(named: "IconReload"), for: .normal)
primaryButton.overrideContentEdgeInsets = true