//
//  MineMoreAllTableViewCell.swift
//  MobilePortal
//
//  Created by xiejiangbo on 2019/3/26.
//  Copyright © 2019 yin chen. All rights reserved.
//

import UIKit

class MineMoreAllTableViewCell: BaseTableViewCell {

    @IBOutlet weak var label: UILabel!
    var xinfo = MineMoreAllTableViewCellModel()
    lazy var titleLable: UILabel = {
        let titleLable = UILabel.init()
        titleLable.textAlignment = .center
        titleLable.font = UIFont.test_systemFont(ofSize: 11.33)
        titleLable.numberOfLines = 0
        titleLable.text = "你可以将常用的板块添加到常用首页，也可以按住拖动调整板块顺序"
        titleLable.textColor = UIColorFromRGB(rgbValue: 0x282A2E)
        self.addSubview(titleLable)
        return titleLable
    }()
    override func awakeFromNib() {
        super.awakeFromNib()
        self.separatorInset=UIEdgeInsetsMake(0, WHIDTH_RATIO(), 0, 0)
        self.backgroundColor = UIColor.white
        //self.backgroundColor = UIColor.red
        label.textColor = blackTitleColor
        label.font = UIFont.test_boldSystemFont(16)
//        label.text = "所有"
        //label.font = UIFont.init(name: "Arial Rounded MT Bold", size: 13)
    }
    
    override func configurateTheCell(_ info: BaseCellModel) {
        xinfo = info as! MineMoreAllTableViewCellModel
        label.text = xinfo.title
        titleLable.text = "你可以将常用的板块添加到"+xinfo.vcTitle!+"，也可以按住拖动调整板块顺序"
        if (self.xinfo.editStatusType == .StartEditing && self.xinfo.isAllType == .OftenType) {
            label.isHidden = true
            titleLable.isHidden = false
            let h = getTextHeigh(textStr: titleLable.text!, font: UIFont.test_systemFont(ofSize: 11.33), width: SCREEN_WHIDTH()-120)
            titleLable.frame = CGRect(x:60, y: 10, width:SCREEN_WHIDTH()-120 , height:h )
        } else if (self.xinfo.editStatusType == .FinishEditing){
            label.isHidden = false
            titleLable.isHidden = true
        }
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }

}
class MineMoreAllTableViewCellModel: BaseCellModel {
    var title:String?
    var editStatusType:EditStatusType = .FinishEditing
    var isAllType:IsAllType = .AllType
    var vcTitle:String?
}
