//
//  AutonomousCompanyTableViewCell.swift
//  MobilePortal
//
//  Created by caiyang on 2020/4/27.
//  Copyright © 2020 yin chen. All rights reserved.
//

import UIKit

class AutonomousCompanyTableViewCell: BaseTableViewCell {
    var xinfo = AutonomousCompanyTableViewCellModel()
    
    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.init()
        titleLabel.textAlignment = .left
        titleLabel.font = UIFont.test_systemFont(ofSize: 13)
        titleLabel.numberOfLines = 0
        //        titleLabel.textColor = blackTitleColor
        titleLabel.textColor = UIColorFromRGB(rgbValue: 0x23262A)
        return titleLabel
    }()
    lazy var selectedImageView: UIImageView = {
        let selectedImageView = UIImageView.init()
        //subImageView.contentMode = .scaleToFill
        selectedImageView.contentMode = .scaleAspectFill
        
        return selectedImageView
    }()
    override func awakeFromNib() {
        super.awakeFromNib()
        self.addSubview(titleLabel)
        self.addSubview(selectedImageView)
        // Initialization code
    }

    override func configurateTheCell(_ info: BaseCellModel) {
        xinfo = info as! AutonomousCompanyTableViewCellModel
        let selectedImageViewW = self.height-20
        selectedImageView.image = UIImage.init(named: "unselected_image")
        selectedImageView.frame = CGRect(x:SCREEN_WHIDTH()-selectedImageViewW-23.34, y: 10, width:selectedImageViewW , height:selectedImageViewW )
        titleLabel.frame = CGRect(x:11.67, y: 0, width:selectedImageView.originX-11.67 , height:self.height )
        titleLabel.text = xinfo.titleStr
        // unselected_image selected_image
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        if selected {
            self.selectedImageView.image = UIImage.init(named: "selected_image")
            self.xinfo.block()
        }
        // Configure the view for the selected state
    }

}
class AutonomousCompanyTableViewCellModel: BaseCellModel {
    var titleStr:String?
    var block:selectBlock!
}
