From 8efaf38395ee74f4d2a2218d4c30e7cff9ca5827 Mon Sep 17 00:00:00 2001 From: CMK Date: Fri, 13 May 2022 17:26:57 +0800 Subject: [PATCH] fix: app enter background break profile header layout issue --- .../Scene/Profile/Header/View/ProfileHeaderView.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift index 78430cb3..1a6e1053 100644 --- a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift +++ b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift @@ -407,8 +407,14 @@ extension ProfileHeaderView { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) - - updateLayoutMargins() + + // workaround enter background breaking the layout issue + switch UIApplication.shared.applicationState { + case .active: + updateLayoutMargins() + default: + break + } } }