From e6ac54bf959431d8ee1ff0096373d62e408dff0e Mon Sep 17 00:00:00 2001 From: sahbazali <30858602+sahbazali@users.noreply.github.com> Date: Wed, 10 Nov 2021 15:45:24 +0300 Subject: [PATCH 1/2] iOS 15 navigation bar ui problem fix. Extension method added for configuring navigation. --- .../Extensions/UINavigationBar+Extensions.swift | 16 ++++++++++++++++ Source/YPImagePicker.swift | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Source/Helpers/Extensions/UINavigationBar+Extensions.swift b/Source/Helpers/Extensions/UINavigationBar+Extensions.swift index 9d209e66b..8f6df8164 100644 --- a/Source/Helpers/Extensions/UINavigationBar+Extensions.swift +++ b/Source/Helpers/Extensions/UINavigationBar+Extensions.swift @@ -15,4 +15,20 @@ extension UINavigationBar { guard let font = font else { return } self.titleTextAttributes = [NSAttributedString.Key.font: font] } + + func configureNavigationBar(isTransculent: Bool, tintColor: UIColor) { + self.tintColor = .ypLabel + + if #available(iOS 15.0, *) { + let appearance = standardAppearance + if isTransculent { + appearance.configureWithTransparentBackground() + } else { + appearance.configureWithOpaqueBackground() + } + scrollEdgeAppearance = appearance + } else { + self.isTranslucent = isTransculent + } + } } diff --git a/Source/YPImagePicker.swift b/Source/YPImagePicker.swift index 9552775c6..3d3d7dbb2 100644 --- a/Source/YPImagePicker.swift +++ b/Source/YPImagePicker.swift @@ -37,7 +37,6 @@ open class YPImagePicker: UINavigationController { super.init(nibName: nil, bundle: nil) modalPresentationStyle = .fullScreen // Force .fullScreen as iOS 13 now shows modals as cards by default. picker.pickerVCDelegate = self - navigationBar.tintColor = .ypLabel } public required init?(coder aDecoder: NSCoder) { @@ -73,7 +72,7 @@ open class YPImagePicker: UINavigationController { } viewControllers = [picker] setupLoadingView() - navigationBar.isTranslucent = false + navigationBar.configureNavigationBar(isTransculent: false, tintColor: .ypLabel) picker.didSelectItems = { [weak self] items in // Use Fade transition instead of default push animation From 96966e0d4a2c5dba59f73b9a335a30a4647f5334 Mon Sep 17 00:00:00 2001 From: sahbazali <30858602+sahbazali@users.noreply.github.com> Date: Wed, 10 Nov 2021 16:05:54 +0300 Subject: [PATCH 2/2] Update UINavigationBar+Extensions.swift hardcoded color corrected --- Source/Helpers/Extensions/UINavigationBar+Extensions.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Helpers/Extensions/UINavigationBar+Extensions.swift b/Source/Helpers/Extensions/UINavigationBar+Extensions.swift index 8f6df8164..5c8d08c5a 100644 --- a/Source/Helpers/Extensions/UINavigationBar+Extensions.swift +++ b/Source/Helpers/Extensions/UINavigationBar+Extensions.swift @@ -17,7 +17,7 @@ extension UINavigationBar { } func configureNavigationBar(isTransculent: Bool, tintColor: UIColor) { - self.tintColor = .ypLabel + self.tintColor = tintColor if #available(iOS 15.0, *) { let appearance = standardAppearance