ios 设置导航栏背景图片,返回title的颜色和文本

    override func viewWillAppear(_ animated: Bool) {
        print("viewWillAppear");
        //设置返回箭头和字体颜色
        self.navigationController?.navigationBar.tintColor = UIColor.black;
        //设置title字体颜色
       let dict:NSDictionary = [NSAttributedStringKey.foregroundColor: UIColor.white];
       self.navigationController?.navigationBar.titleTextAttributes = dict as? [NSAttributedStringKey : Any];
        //设置导航栏的背景图
        self.navigationController?.navigationBar.setBackgroundImage(UIImage.init(named: "about us_bg_bar.png"), for: UIBarMetrics.default)
       //设置返回箭头右边的文本内容
        self.navigationController?.navigationBar.topItem?.title = "这是";
        //设置title的文本内容
        self.title = "CONTROL SELECT";
    }
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页