Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 10, UIToolbar background color does not change

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

like image 296
Jp4Real Avatar asked Aug 23 '16 17:08

Jp4Real


1 Answers

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

like image 62
Jp4Real Avatar answered Oct 06 '22 03:10

Jp4Real