我有一个应用程序,自iOS 8以来一直存在.它的工作方式是你有一个UITableView并点击单元格来产生一个分数,取决于底部的UI工具栏使用此方法改变颜色的分数:
- 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 }
- }
然后每当用这个点击表格视图时调用它:
func tableView(tableView:UITableView,didSelectRowAtIndexPath indexPath:NSIndexPath)
{
事情是,它自从我构建应用程序以来一直有效,但在iOS 10上,它没有.简单地把颜色改变了……
任何帮助,将不胜感激
解决方法
我能够解决它,它改为:BarTintColor,发现它自己在苹果文档中找不到任何提及它的东西
像这样使用它:self.toolbar.barTintColor
编辑:现在有一些人在GM发布文档中提到它,请参阅下面的回答