Fixes displaying system name in dark text when remapping inputs on iOS 16
This commit is contained in:
parent
fd2cf223dc
commit
48be35cbf2
@ -38,11 +38,23 @@ extension UINavigationBar
|
||||
private var _defaultTitleTextAttributes: [NSAttributedString.Key: Any]? {
|
||||
guard self.titleTextAttributes == nil else { return self.titleTextAttributes }
|
||||
|
||||
guard
|
||||
let contentView = self.subviews.first(where: { NSStringFromClass(type(of: $0)).contains("ContentView") || NSStringFromClass(type(of: $0)).contains("ItemView") }),
|
||||
let titleLabel = contentView.subviews.first(where: { $0 is UILabel }) as? UILabel
|
||||
guard let contentView = self.subviews.first(where: { NSStringFromClass(type(of: $0)).contains("ContentView") || NSStringFromClass(type(of: $0)).contains("ItemView") })
|
||||
else { return nil }
|
||||
|
||||
let containerView: UIView
|
||||
|
||||
if #available(iOS 16, *)
|
||||
{
|
||||
guard let titleControl = contentView.subviews.first(where: { NSStringFromClass(type(of: $0)).contains("Title") }) else { return nil }
|
||||
containerView = titleControl
|
||||
}
|
||||
else
|
||||
{
|
||||
containerView = contentView
|
||||
}
|
||||
|
||||
guard let titleLabel = containerView.subviews.first(where: { $0 is UILabel }) as? UILabel else { return nil }
|
||||
|
||||
let textAttributes = titleLabel.attributedText?.attributes(at: 0, effectiveRange: nil)
|
||||
return textAttributes
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user