iOS 10, UIToolbar background color does not change

Jp4Real picture Jp4Real · Aug 23, 2016 · Viewed 9.4k times · Source

I have an app that's been around since iOS 8. the way it's working is that you have a UITableView and tap on cells to produce a score, depending on the score the UItoolbar at the bottom changes color using this method :

func updateToolbarAndLabel(score: Int) {

    if(score <= -1) {
        self.toolbar.backgroundColor = UIColor.greenColor()
    } else if(score <= 0) {
        self.toolbar.backgroundColor = .None
    } else if(score <= 9) {
        self.toolbar.backgroundColor = UIColor.greenColor()
    } else if(score <= 29) {
       self.toolbar.backgroundColor = UIColor.yellowColor()
    } else if(score >= 30) {
        self.toolbar.backgroundColor = UIColor.redColor()
    }
    if (score <= 0) {
        self.scoreshow.text = "0"
    } else {
        self.scoreshow.text = (score as NSNumber).stringValue }
}

then it's called everytime the table view is tapped with this :

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

thing is, it always worked ever since I built the App, but on iOS 10, it doesn't. simply put the color does not change...

Any Help would be appreciated

Answer

Jp4Real picture Jp4Real · Sep 18, 2016

I was able to solve it, it's changed to this : BarTintColor, found it myself couldn't find anything in apple docs mentionning it

Use it like this : self.toolbar.barTintColor

edit : there is sometinhg mentionning it now in the GM release docs, see answer bellow