How to change color of back button on NavigationView

后端 未结 6 1699
情书的邮戳
情书的邮戳 2021-01-02 04:56

When you click on the button it takes you to a new view and puts a back button in the top left. I can\'t figure out what property controls the color of the back button. I tr

6条回答
  •  情歌与酒
    2021-01-02 05:06

    I doubt this is the right way to do it, but I got it to work by modifying the SceneDelegate.swift to set the window tint color.

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    
        // Use a UIHostingController as window root view controller
        let window = UIWindow(frame: UIScreen.main.bounds)
        window.rootViewController = UIHostingController(rootView: ContentView())
        window.tintColor = .green // set the colour of the back navigation text
        self.window = window
        window.makeKeyAndVisible()
    }
    

提交回复
热议问题