Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 15 navigation bar UI problem #710

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Source/Helpers/Extensions/UINavigationBar+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 = tintColor

if #available(iOS 15.0, *) {
let appearance = standardAppearance
if isTransculent {
appearance.configureWithTransparentBackground()
} else {
appearance.configureWithOpaqueBackground()
}
scrollEdgeAppearance = appearance
} else {
self.isTranslucent = isTransculent
}
}
}
3 changes: 1 addition & 2 deletions Source/YPImagePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down