From da9af9a076e717622b6c46ed241085d6ed498087 Mon Sep 17 00:00:00 2001 From: CMK Date: Wed, 23 Jun 2021 14:46:58 +0800 Subject: [PATCH] fix: primary action button appearance issue intro in af42540 --- .../Scene/Onboarding/Welcome/WelcomeViewController.swift | 1 + Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift index 3ee2a4b0..8dba6d70 100644 --- a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift +++ b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift @@ -36,6 +36,7 @@ final class WelcomeViewController: UIViewController, NeedsDependency { private(set) lazy var signUpButton: PrimaryActionButton = { let button = PrimaryActionButton() + button.adjustsBackgroundImageWhenUserInterfaceStyleChanges = false button.setTitle(L10n.Common.Controls.Actions.signUp, for: .normal) let backgroundImageColor: UIColor = traitCollection.userInterfaceIdiom == .phone ? .white : Asset.Colors.brandBlue.color let backgroundImageHighlightedColor: UIColor = traitCollection.userInterfaceIdiom == .phone ? UIColor(white: 0.8, alpha: 1.0) : Asset.Colors.brandBlueDarken20.color diff --git a/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift b/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift index 75e03d97..326dfa12 100644 --- a/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift +++ b/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift @@ -20,6 +20,8 @@ class PrimaryActionButton: UIButton { }() private var originalButtonTitle: String? + + var adjustsBackgroundImageWhenUserInterfaceStyleChanges = true override init(frame: CGRect) { super.init(frame: frame) @@ -51,7 +53,9 @@ extension PrimaryActionButton { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) - setupBackgroundAppearance() + if adjustsBackgroundImageWhenUserInterfaceStyleChanges { + setupBackgroundAppearance() + } } func showLoading() {