繁体   English   中英

如何使这个 iOS 导航栏颜色更改在 UIPageViewController 的上下文中工作?

[英]How do I make this iOS navigation bar color change work in the context of a UIPageViewController?

此代码用于在我的初始 viewController 中设置导航栏的颜色。 但是,当我转到嵌入在 UIPageViewController 中的下一个 VC 时,它不会更新。 我已经为 UIPageViewController 本身和它加载的第一个 VC 尝试了 viewDidLoad 中的代码,但都没有更新实际的导航栏颜色(尽管打印 function 运行成功)。

        if #available(iOS 15, *) {

            let appearance = UINavigationBarAppearance()
            print("wlVWA")
            appearance.configureWithOpaqueBackground()
            appearance.backgroundColor = Colors.colorTitleScheme[1].0
            UINavigationBar.appearance().standardAppearance = appearance
            UINavigationBar.appearance().scrollEdgeAppearance = appearance
            
        } 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM