1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- //
- // UnderLineTrainTableViewCell.swift
- // xingchuangke
- //
- // Created by Virgil on 2019/5/13.
- // Copyright © 2019 Virgil. All rights reserved.
- //
- import UIKit
- class UnderLineTrainTableViewCell: UITableViewCell {
- @IBOutlet weak var viewContent: UIView!
- @IBOutlet weak var btnState: UIButton!
- @IBOutlet weak var lblName: UILabel!
- @IBOutlet weak var img: UIImageView!
- @IBOutlet weak var imgHeight: NSLayoutConstraint!
- override func awakeFromNib() {
- super.awakeFromNib()
- // Initialization code
- btnState.setCornerRadius(size: btnState.height() / 2)
- imgHeight.constant = (ScreenWidth - 48) / 327 * 121
- viewContent.setCornerRadius(size: 8)
- }
- func initCell(dic: NSDictionary) {
- img.loadImage(imgUrl: dic.getString(key: "image"), defaultImage: "")
- lblName.text = dic.getString(key: "title")
- let state = dic.getInt(key: "status")
- if state == 0 {
- btnState.setTitle("未开始", for: .normal)
- btnState.backgroundColor = CommonUntils.getUIColorFromRGB(rgbValue: 0x37a6ff, alpha: 1.0)
- } else if state == 1 {
- btnState.setTitle("进行中", for: .normal)
- btnState.backgroundColor = CommonUntils.getUIColorFromRGB(rgbValue: 0x37a6ff, alpha: 1.0)
- } else {
- btnState.setTitle("已结束", for: .normal)
- btnState.backgroundColor = CommonUntils.getUIColorFromRGB(rgbValue: 0xcccccc, alpha: 1.0)
- }
- }
- override func setSelected(_ selected: Bool, animated: Bool) {
- super.setSelected(selected, animated: animated)
- // Configure the view for the selected state
- }
- }
|