f2cf74c7
yangbin
1.0.20(4)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
//
// MotionCell.swift
// Twear
//
// Created by yangbin on 2021/11/16.
//
import UIKit
class MotionCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var distnaceLabel: UILabel!
|
e1017215
daifengyi
feat:home page UI
|
15
|
@IBOutlet weak var noDataLabel: UILabel!
|
f2cf74c7
yangbin
1.0.20(4)
|
16
17
18
19
20
|
@IBOutlet weak var titleLabel: UILabel!
var motion: MotionModel = MotionModel() {
didSet {
if motion.date == nil {
|
e1017215
daifengyi
feat:home page UI
|
21
|
dateLabel.text = ""
|
f2cf74c7
yangbin
1.0.20(4)
|
22
|
imageView.image = UIImage(named: "home_motion_nodata")
|
e1017215
daifengyi
feat:home page UI
|
23
24
|
imageView.isHidden = true
noDataLabel.isHidden = false
|
f2cf74c7
yangbin
1.0.20(4)
|
25
26
27
28
29
30
31
32
33
34
35
|
distnaceLabel.text = ""
} else {
if UserInfo.distanceUnit == 0 {
distnaceLabel.toUnitMode(text: String(format:"%.2f",Float(motion.distance)/1000), unit: " \(LocString("公里"))", font: BoldFont(25), unitFont: RegularFont(11), unitColor: UIColor.rgbColorFromHex(0x808080))
} else {
distnaceLabel.toUnitMode(text: (Float(motion.distance)/1000).mileString(), unit: " \(LocString("英里"))", font: BoldFont(25), unitFont: RegularFont(11), unitColor: UIColor.rgbColorFromHex(0x808080))
}
// distnaceLabel.text = String(format:"%.2f",Float(motion.distance)/1000) + "公里"
dateLabel.text = motion.date!.toString(.custom("yyyy/MM/dd"))
imageView.image = UIImage(named: "home_motion_bg")
|
e1017215
daifengyi
feat:home page UI
|
36
37
|
imageView.isHidden = false
noDataLabel.isHidden = true
|
f2cf74c7
yangbin
1.0.20(4)
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
}
}
}
// func getHeight() -> CGFloat {
// return train.count*
// }
override func awakeFromNib() {
super.awakeFromNib()
titleLabel.text = LocString("运动记录")
// Initialization code
}
}
|