티스토리 뷰

        let navController = navigationController!

        

        if navController.navigationBar.isHidden {

            navController.navigationBar.isHidden = false

        }

        

        navController.navigationBar.barTintColor = UIColor.black

        navController.navigationBar.tintColor = UIColor.white

        

        navController.navigationBar.isTranslucent = false

        navController.navigationBar.setValue(true, forKey: "hidesShadow")

        

        let navTitleTextAttributes = [

            NSAttributedString.Key.font: UIFont.defaultFont, NSAttributedString.Key.foregroundColor: UIColor.white

        ]

        UIBarButtonItem.appearance().setTitleTextAttributes(navTitleTextAttributes, for: .normal)

        UINavigationBar.appearance().titleTextAttributes = navTitleTextAttributes

        navController.navigationBar.titleTextAttributes = navTitleTextAttributes

        self.navigationItem.title = {navigaionTitle}

        

        let barButton = UIBarButtonItem(image: UIImage(named: "{backButtonImage}"), style: .plain, target: self, action: backAction)

        barButton.imageInsets = UIEdgeInsets.init(top: 0, left: -18, bottom: 0, right: 0)

        

        if showBackButton {

            navigationItem.setLeftBarButton(barButton, animated: false)

        }

        else {

            navigationItem.setLeftBarButton(nil, animated: false)

            navigationItem.hidesBackButton = true

        }

        

댓글