From 69eff8fa284247616b5fe0993684ecfe6572d894 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 16 Jun 2023 15:55:51 -0500 Subject: [PATCH] Fixes displaying system name in dark text (again) when remapping inputs on iOS 17 --- .../Popover Menu/PopoverMenuButton.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Delta/Components/Popover Menu/PopoverMenuButton.swift b/Delta/Components/Popover Menu/PopoverMenuButton.swift index 27fcc8b..164746e 100644 --- a/Delta/Components/Popover Menu/PopoverMenuButton.swift +++ b/Delta/Components/Popover Menu/PopoverMenuButton.swift @@ -17,7 +17,7 @@ extension UINavigationBar } // Make "copy" of self. - let navigationBar = UINavigationBar(frame: .zero) + let navigationBar = UINavigationBar(frame: self.bounds) // Use self.bounds to avoid "Unable to simultaneously satisfy constraints" runtime error. navigationBar.barStyle = self.barStyle // Set item with title so we can retrieve default text attributes. @@ -43,10 +43,20 @@ extension UINavigationBar let containerView: UIView + //TODO: Recursively search all subviews for title UILabel instead of hardcoded OS version-specific hierarchy traversals... if #available(iOS 16, *) { guard let titleControl = contentView.subviews.first(where: { NSStringFromClass(type(of: $0)).contains("Title") }) else { return nil } - containerView = titleControl + + if #available(iOS 17, *) + { + guard let view = titleControl.subviews.first else { return nil } + containerView = view + } + else + { + containerView = titleControl + } } else {