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.
102 lines
3.4 KiB
102 lines
3.4 KiB
![]()
2 years ago
|
//
|
||
|
// HealthNavigationBar.swift
|
||
![]()
1 year ago
|
// FireBoltt
|
||
![]()
2 years ago
|
//
|
||
|
// Created by lemo. on 2020/4/6.
|
||
|
// Copyright © 2020 Sheldon. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import UIKit
|
||
|
|
||
|
// MARK:- 常量
|
||
|
fileprivate struct Metric {
|
||
|
static let backgroundColor = kHexColor(0xFBFBFB)
|
||
|
static let titleFont = SystemRegularFont(18)
|
||
|
static let otherColor = kHexColor(0x000000)
|
||
|
static let otherFont = SystemRegularFont(10)
|
||
|
}
|
||
|
|
||
|
class HealthNavigationBar: UIButton {
|
||
|
|
||
![]()
1 year ago
|
lazy var fb_headImg: UIImageView = {
|
||
![]()
2 years ago
|
let img = UIImageView()
|
||
|
img.layer.cornerRadius = kScaleWidth(45) / 2.0
|
||
|
img.layer.masksToBounds = true
|
||
|
return img
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fb_nicknameLabel: UILabel = {
|
||
![]()
2 years ago
|
let label = UILabel()
|
||
|
label.textColor = kHexColor(0x2A2A2A)
|
||
|
label.font = SystemRegularFont(17)
|
||
|
return label
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fb_rightArrow: UIImageView = {
|
||
|
let img = UIImageView(image: R.image.fb_icon_arrow_down())
|
||
![]()
2 years ago
|
return img
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fb_statusBtn: UIButton = {
|
||
![]()
2 years ago
|
let btn = UIButton(type: .custom).then {
|
||
|
$0.setTitleColor(Metric.otherColor, for: .normal)
|
||
|
$0.titleLabel?.font = Metric.otherFont
|
||
|
$0.imageEdgeInsets = UIEdgeInsets(top: 0, left: -10, bottom: 0, right: 0)
|
||
|
addSubview($0)
|
||
|
}
|
||
![]()
1 year ago
|
btn.setImage(R.image.fb_icon_watch_notConnect(), for: .normal)
|
||
|
btn.setTitle(MultiLanguageKey_FB.disConnectedFB.localized, for: .normal)
|
||
|
btn.setImage(R.image.fb_icon_watch_connect(), for: .selected)
|
||
|
btn.setTitle(MultiLanguageKey_FB.coonectedFB.localized, for: .selected)
|
||
![]()
2 years ago
|
return btn
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fb_powerBtn: UIButton = {
|
||
![]()
2 years ago
|
let btn = UIButton(type: .custom).then {
|
||
|
$0.setTitleColor(Metric.otherColor, for: .normal)
|
||
|
$0.titleLabel?.font = Metric.otherFont;
|
||
|
$0.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -10)
|
||
|
addSubview($0)
|
||
|
}
|
||
|
btn.setImage(R.image.power_0(), for: .normal)
|
||
![]()
1 year ago
|
btn.setTitle(MultiLanguageKey_FB.powerFB.localized, for: .normal)
|
||
![]()
2 years ago
|
return btn
|
||
|
}()
|
||
|
|
||
|
override init(frame: CGRect) {
|
||
|
super.init(frame: frame)
|
||
![]()
1 year ago
|
addSubview(fb_headImg)
|
||
|
addSubview(fb_nicknameLabel)
|
||
|
addSubview(fb_rightArrow)
|
||
|
addSubview(fb_statusBtn)
|
||
|
addSubview(fb_powerBtn)
|
||
![]()
2 years ago
|
setUpUI()
|
||
|
}
|
||
|
|
||
|
func setUpUI() {
|
||
![]()
1 year ago
|
fb_headImg.snp.makeConstraints { (make) in
|
||
![]()
2 years ago
|
make.left.equalTo(15)
|
||
|
make.top.equalTo(kBatteryH + 10)
|
||
|
make.width.height.equalTo(kScaleWidth(45))
|
||
|
}
|
||
![]()
1 year ago
|
fb_nicknameLabel.snp.makeConstraints { (make) in
|
||
|
make.centerY.equalTo(fb_headImg.snp.centerY)
|
||
|
make.left.equalTo(fb_headImg.snp.right).offset(kScaleWidth(10))
|
||
![]()
2 years ago
|
}
|
||
![]()
1 year ago
|
fb_rightArrow.snp.makeConstraints { (make) in
|
||
|
make.centerY.equalTo(fb_headImg.snp.centerY)
|
||
|
make.left.equalTo(fb_nicknameLabel.snp.right).offset(kScaleWidth(10))
|
||
![]()
2 years ago
|
}
|
||
![]()
1 year ago
|
fb_powerBtn.snp.makeConstraints { (make) in
|
||
![]()
2 years ago
|
make.right.equalTo(-15)
|
||
![]()
1 year ago
|
make.centerY.equalTo(fb_headImg.snp.centerY)
|
||
![]()
2 years ago
|
}
|
||
![]()
1 year ago
|
fb_statusBtn.snp.makeConstraints { (make) in
|
||
|
make.right.equalTo(fb_powerBtn.snp.left).offset(-15)
|
||
|
make.centerY.equalTo(fb_headImg.snp.centerY)
|
||
![]()
2 years ago
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
required init?(coder: NSCoder) {
|
||
|
fatalError("init(coder:) has not been implemented")
|
||
|
}
|
||
|
|
||
|
}
|