Q:

swift change label on uitableviewcell background color

I have UItablview with custom cell i need to change a label background colour when select this row, but the label colour is repeated when scroll down 

A:

You could subclass your Cell like this (and cellForRow then will not be responsible for updating the color, only for setting default color).  
class YourTableViewCellClass: UITableViewCell {

    @IBOutlet weak var yourLabel: UILabel!

    override func setSelected(_ selected: Bool, animated: Bool) {
    if(selected) {

        self.contentView.backgroundColor = UIColor.red //or what you want as your cell bg color
        self.yourLabel.backgroundColor = UIColor.green //or what you want

    } else {

        self.contentView.backgroundColor = UIColor.white //or what you want as your cell bg color
        self.yourLabel.backgroundColor = UIColor.red //or what you want
    }
} }

