HomeTableViewCell.swift
3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// HomeTableViewCell.swift
// YouerLiveVideo
//
// Created by 葛建军 on 17/1/14.
// Copyright © 2017年 左丞. All rights reserved.
//
import UIKit
class HomeTableViewCell: UITableViewCell {
@IBOutlet var personIcon: UIImageView!
@IBOutlet var titleLabel: UILabel!
@IBOutlet var timeLabel: UILabel!
@IBOutlet var detailView: UIView!
@IBOutlet var numberPeople: UILabel!
@IBOutlet var numberCare: UILabel!
@IBOutlet var passLabel: UILabel!
@IBOutlet var liveimageView: UIImageView!
@IBOutlet var tagLabel: UILabel!
@IBOutlet weak var rommNameLabel: UILabel!
let formatte=DateFormatter()
override func awakeFromNib() {
super.awakeFromNib()
tagLabel.layer.cornerRadius = 5
tagLabel.layer.masksToBounds=true
tagLabel.layer.borderWidth=1.0
tagLabel.layer.borderColor=Theme.topBarColor().cgColor
formatte.dateFormat="yyyy-MM-dd HH:mm:ss"
}
func setUpWith(item:LiveDetail){
passLabel.isHidden=true
detailView.isHidden=true
personIcon.sd_setImage(with: URL(string:item.f_HeadIcon), placeholderImage: UIImage(named:"defphoto"))
titleLabel.text=item.f_RealName
timeLabel.text=formatte.string(from: Date(timeIntervalSince1970: JSON.fromString(jsonString: item.f_Description)!["starttime"].doubleValue/1000 as TimeInterval))
liveimageView.sd_setImage(with: URL(string:item.f_LiveImg), placeholderImage: UIImage(named:"placeholder"))
tagLabel.text=" "+item.f_CategoryName+" "
rommNameLabel.text = item.f_LiveName
}
func setUpWith(type:LivesType,item:LiveDetail){
personIcon.sd_setImage(with: URL(string:item.f_HeadIcon), placeholderImage: UIImage(named:"defphoto"))
titleLabel.text=item.f_LiveName
timeLabel.text=formatte.string(from: Date(timeIntervalSince1970: JSON.fromString(jsonString: item.f_Description)!["starttime"].doubleValue/1000 as TimeInterval))
liveimageView.sd_setImage(with: URL(string:item.f_LiveImg), placeholderImage: UIImage(named:"placeholder"))
tagLabel.text=item.f_CategoryName
switch type {
case LivesType.liveList://直播列表
passLabel.isHidden=false
detailView.isHidden=true
if item.f_IsExamine==1 {
passLabel.backgroundColor=Theme.topBarColor()
passLabel.text="已通过"
}else if item.f_IsExamine==2 {
passLabel.backgroundColor=UIColor.gray
passLabel.text="未通过"
}else{
passLabel.backgroundColor=UIColor.gray
passLabel.text="待审核"
}
break
case LivesType.liveHistory://直播历史
passLabel.isHidden=true
detailView.isHidden=false
//多少人观看,多少人关注
break
default:
passLabel.isHidden=true
detailView.isHidden=false
}
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}