swift cell 选中时候背景颜色 和其他选项

//
// TerantListCell.swift
// happayCollection
//
// Created by 廖马儿 on 2016/11/14.
// Copyright © 2016年 youpude. All rights reserved.
//

import UIKit

class TerantListCell: UITableViewCell {

@IBOutlet weak var title_label: UILabel!

@IBOutlet weak var checkImg: UIImageView!


override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
    
    checkImg.isHidden = true
}

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

    // Configure the view for the selected state
    if selected {
        
        title_label.textColor = UIColor.init(red: 230.0/255.0, green: 60.0/255.0, blue: 22.0/255.0, alpha: 1.0)
        checkImg.isHidden = false
        selectedBackgroundView = UIView.init(frame: self.bounds)
        selectedBackgroundView?.tintColor = UIColor.white
    }else {
    
        title_label.textColor = Global.COLOR_999999
        checkImg.isHidden = true
    }
   
}

override func select(_ sender: Any?) {
    
    super.select(sender)
    
}  

}

你可能感兴趣的:(swift cell 选中时候背景颜色 和其他选项)