fix: primary action button appearance issue intro in af42540

This commit is contained in:
CMK 2021-06-23 14:46:58 +08:00
parent b593938767
commit da9af9a076
2 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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() {