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.
 
 
 

101 lines
3.4 KiB

//
// HealthNavigationBar.swift
// FireBoltt
//
// 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 {
lazy var fb_headImg: UIImageView = {
let img = UIImageView()
img.layer.cornerRadius = kScaleWidth(45) / 2.0
img.layer.masksToBounds = true
return img
}()
lazy var fb_nicknameLabel: UILabel = {
let label = UILabel()
label.textColor = kHexColor(0x2A2A2A)
label.font = SystemRegularFont(17)
return label
}()
lazy var fb_rightArrow: UIImageView = {
let img = UIImageView(image: R.image.fb_icon_arrow_down())
return img
}()
lazy var fb_statusBtn: UIButton = {
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)
}
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)
return btn
}()
lazy var fb_powerBtn: UIButton = {
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)
btn.setTitle(MultiLanguageKey_FB.powerFB.localized, for: .normal)
return btn
}()
override init(frame: CGRect) {
super.init(frame: frame)
addSubview(fb_headImg)
addSubview(fb_nicknameLabel)
addSubview(fb_rightArrow)
addSubview(fb_statusBtn)
addSubview(fb_powerBtn)
setUpUI()
}
func setUpUI() {
fb_headImg.snp.makeConstraints { (make) in
make.left.equalTo(15)
make.top.equalTo(kBatteryH + 10)
make.width.height.equalTo(kScaleWidth(45))
}
fb_nicknameLabel.snp.makeConstraints { (make) in
make.centerY.equalTo(fb_headImg.snp.centerY)
make.left.equalTo(fb_headImg.snp.right).offset(kScaleWidth(10))
}
fb_rightArrow.snp.makeConstraints { (make) in
make.centerY.equalTo(fb_headImg.snp.centerY)
make.left.equalTo(fb_nicknameLabel.snp.right).offset(kScaleWidth(10))
}
fb_powerBtn.snp.makeConstraints { (make) in
make.right.equalTo(-15)
make.centerY.equalTo(fb_headImg.snp.centerY)
}
fb_statusBtn.snp.makeConstraints { (make) in
make.right.equalTo(fb_powerBtn.snp.left).offset(-15)
make.centerY.equalTo(fb_headImg.snp.centerY)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}