如何在swift 4中将navigationItem.title更改为白色?

时间:2018-05-27 16:12:29

标签: swift firebase uinavigationitem

如何在swift 4中将navigationItem.title更改为白色?

let uid = Auth.auth().currentUser?.uid
Database.database().reference().child("users").child(uid!).observeSingleEvent(of: .value, with: {(snapshot) in          
    if let dictionary = snapshot.value as? [String: AnyObject] {
        self.navigationItem.title = dictionary["name"] as? String
        self.navigationController?.navigationBar.prefersLargeTitles = true
    }
},withCancel: nil)

2 个答案:

答案 0 :(得分:1)

您可以使用以下方法更改标题颜色:

var svg = d3.select("body")
  .append("svg")
  .attr("width",500)
  .attr("height",300);
  
var circle = svg.append("circle")
  .attr("cx",100)
  .attr("cy",100)
  .attr("r",20)
  .attr("fill","steelblue")
  .call(d3.drag().on("start", function() {
      d3.select(this).attr("fill", "orange")
    })
    .on("drag", function() {
      d3.select(this).attr("cx",d3.event.x)
        .attr("cy", d3.event.y )
    })
    .on("end", function() {
      d3.select(this).attr("fill","steelblue");
    })
  )

答案 1 :(得分:0)

self.navigationController?.navigationBar.tintColor = .white