在另一个视图中按下按钮后,在表格视图单元格中更改视图

时间:2014-10-15 13:52:49

标签: ios uitableview swift

我希望在表视图中的另一个视图中按下按钮后更改我在表格视图单元格中的视图的背景颜色。视图作为IBOutlet连接到表视图单元类。我试过使用委托,但它似乎没有用:

//tableview class
protocol ViewDelegate {
    func changeBackground()
}
...
var delegate: ViewDelegate?

//the IBAction {
    delegate?.changeBackground()   
}

//tableviewcell class
class TableViewCell: UITableViewCell , ViewDelegate {
    func changeBackground() {
        self.cellView.backgroundColor = UIColor.redColor()
    }
}

我该怎么办?非常感谢:))

0 个答案:

没有答案
相关问题