You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.1 KiB
77 lines
2.1 KiB
// |
|
// HealthBlockView.swift |
|
// Lookfit |
|
// |
|
// Created by lemo. on 2020/4/8. |
|
// Copyright © 2020 Sheldon. All rights reserved. |
|
// |
|
|
|
import UIKit |
|
|
|
class HealthBlockView: UIView { |
|
|
|
lazy var bgImgBtn: UIButton = { |
|
let btn = UIButton() |
|
btn.isEnabled = false |
|
return btn |
|
}() |
|
lazy var titleLabel: UILabel = { |
|
let label = UILabel() |
|
label.font = SystemRegularFont(12) |
|
label.textColor = kHexColor(0x666666) |
|
return label |
|
}() |
|
lazy var centerLabel: UILabel = { |
|
let label = UILabel() |
|
label.font = DigitalFont(32) |
|
return label |
|
}() |
|
lazy var unitLabel: UILabel = { |
|
let label = UILabel() |
|
label.font = SystemRegularFont(12) |
|
return label |
|
}() |
|
lazy var sleepCircleView: CircleView = { |
|
let view = CircleView(lineWidth: 5, bottomColor: kHexColor(0xE5EEFF), progressColor: kHexColor(0x59AAFF), type: .base) |
|
view.isUserInteractionEnabled = false |
|
return view |
|
}() |
|
|
|
override init(frame: CGRect) { |
|
super.init(frame: frame) |
|
addSubview(bgImgBtn) |
|
addSubview(titleLabel) |
|
addSubview(centerLabel) |
|
addSubview(unitLabel) |
|
addSubview(sleepCircleView) |
|
layoutUI() |
|
} |
|
|
|
func layoutUI() { |
|
bgImgBtn.snp.makeConstraints { (make) in |
|
make.edges.equalToSuperview() |
|
} |
|
titleLabel.snp.makeConstraints { (make) in |
|
make.top.equalTo(15) |
|
make.centerX.equalToSuperview() |
|
} |
|
centerLabel.snp.makeConstraints { (make) in |
|
make.top.equalTo(kScaleWidth(64)) |
|
make.centerX.equalToSuperview() |
|
} |
|
unitLabel.snp.makeConstraints { (make) in |
|
make.top.equalTo(centerLabel.snp.bottom) |
|
make.centerX.equalToSuperview() |
|
} |
|
sleepCircleView.snp.makeConstraints { (make) in |
|
make.top.equalTo(45) |
|
make.width.height.equalTo(kScaleWidth(90)) |
|
make.centerX.equalToSuperview() |
|
} |
|
} |
|
|
|
required init?(coder: NSCoder) { |
|
fatalError("init(coder:) has not been implemented") |
|
} |
|
|
|
}
|
|
|