如何隐藏默认导航栏锡颜色

时间:2017-12-29 19:45:13

标签: ios swift uinavigationbar

我正在尝试创建自定义导航栏。这是我的代码

let color = UIColor(hex: "BC324A")
 let navigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width,height: 50))
            navigationBar.barTintColor = color
            navigationBar.backgroundColor = color


    let button = UIButton.init(type: .custom)
        button.setImage(UIImage.init(named: "MenuI.png"), for: UIControlState.normal)
        button.addTarget(self, action:#selector(BaseViewController.onSlideMenuButtonPressed(_:)), for: UIControlEvents.touchUpInside)
        button.frame = CGRect.init(x: 50, y: 0, width: 20, height: 30)
            button.imageView?.contentMode = .scaleAspectFit
            button.layer.borderWidth = 1
            button.layer.borderColor = UIColor.white.cgColor
        let customBarItem = UIBarButtonItem(customView: button)



    self.navigationItem.leftBarButtonItems = [customBarItem]

            navigationBar.items = [navigationItem]

        // Make the navigation bar a subview of the current view controller
        self.view.addSubview(navigationBar)

这里是我的导航栏enter image description here

的图片
  

如果仔细查看此导航,您可以看到我的其他颜色   自定义导航栏。我怎样才能删除这种颜色?

0 个答案:

没有答案