import UIKit
class HomeHeadInfoView: BaseColletionSetionHeader {
+ let icon = UIImageView()
let titleLabel = UILabel()
let deviceLabel = UILabel()
let nameLabel = UILabel()
override func setupViews() {
- addSubviews([titleLabel,deviceLabel,nameLabel])
+ addSubviews([icon,titleLabel,deviceLabel,nameLabel])
titleLabel.do { (v) in
v.textColor = .color(.first)
- v.font = .regular(32)
+ v.font = .regular(24)
v.textAlignment = .left
}
deviceLabel.do { (v) in
- v.textColor = .color(.secondary)
+ v.textColor = .color(.tertiary)
v.font = .regular(14)
v.textAlignment = .left
v.text = "共4个智能设备"
v.font = .medium(22)
v.textAlignment = .left
v.text = "设备".l10n
+ v.isHidden = true
}
}
override func setupLayout() {
-
+ icon.snp.makeConstraints { make in
+ make.size.equalTo(50)
+ make.left.equalToSuperview()
+ make.top.equalToSuperview()
+ }
titleLabel.snp.makeConstraints { (m) in
- m.top.equalToSuperview().inset(10)
- m.left.equalToSuperview().inset(14)
+ m.top.equalToSuperview().inset(60)
+ m.left.equalToSuperview().inset(0)
m.right.equalToSuperview().offset(-20)
}
deviceLabel.snp.makeConstraints { (m) in
- m.top.equalToSuperview().inset(50)
- m.left.equalToSuperview().inset(14)
+ m.top.equalTo(titleLabel.snp.bottom).offset(0)
+ m.left.equalTo(titleLabel)
m.height.equalTo(30)
// m.width.equalTo(120)
}
func updateUI(){
titleLabel.text = CacheManager.shared.user.info.userName
deviceLabel.text = "\(DeviceVM.shared.dataList.count) " + "个智能设备".l10n
+ icon.kf.setImage(with:CacheManager.shared.user.info.avatar.yc.asUrl )
}
func updateColor(_ model:BackgroundModel?){
guard let model = model else { return }
class BleScanHeaderView: BaseView {
- let rippleView = DGActivityIndicatorView(type: .triplePulse,tintColor: UIColor.color(.theme),size: 250)!
- var radarImageView = UIImageView()
+ let rippleView = DGActivityIndicatorView(type: .triplePulse,tintColor: UIColor.color(.theme),size: 250)!
+ var radarImageView = UIImageView()
override func setupViews() {
-// backgroundColor = .red
-// rippleView.backgroundColor = .red
- addSubviews([rippleView,radarImageView])
- rippleView.startAnimating()
- radarImageView.do { v in
-// v.image = UIImage(named: "device_logo")
-// v.backgroundColor = .lightGray
-//
-// let animation = CABasicAnimation.init(keyPath: "transform.rotation.z")
-// animation.beginTime = 0.0
-// animation.fromValue = 0.0
-// animation.toValue = 2*Double.pi
-// animation.duration = 2.5
-// animation.repeatCount = MAXFLOAT
-// v.layer.add(animation, forKey: "radar.transform.rotation.x")
- }
-
- }
- override func setupLayout() {
- radarImageView.snp.makeConstraints { make in
- make.width.equalTo(58)
- make.height.equalTo(46)
- make.center.equalToSuperview()
+ if CCDevice.isJoy {
+ addSubviews([rippleView,radarImageView])
+ rippleView.startAnimating()
+
+ radarImageView.do { v in
+ v.image = UIImage(named: "device_logo")
+ //
+ // let animation = CABasicAnimation.init(keyPath: "transform.rotation.z")
+ // animation.beginTime = 0.0
+ // animation.fromValue = 0.0
+ // animation.toValue = 2*Double.pi
+ // animation.duration = 2.5
+ // animation.repeatCount = MAXFLOAT
+ // v.layer.add(animation, forKey: "radar.transform.rotation.x")
+ }
+ radarImageView.snp.makeConstraints { make in
+ make.width.equalTo(58)
+ make.height.equalTo(46)
+ make.center.equalToSuperview()
+ }
+ rippleView.snp.makeConstraints { make in
+ make.size.equalTo(250)
+ make.center.equalToSuperview()
+ }
}
- rippleView.snp.makeConstraints { make in
- make.size.equalTo(250)
- make.center.equalToSuperview()
+ else{
+ addSubviews([radarImageView])
+
+ radarImageView.do { v in
+ v.image = UIImage(named: "radar_icon")
+ //
+ let animation = CABasicAnimation.init(keyPath: "transform.rotation.z")
+ animation.beginTime = 0.0
+ animation.fromValue = 0.0
+ animation.toValue = 2*Double.pi
+ animation.duration = 2
+ animation.repeatCount = MAXFLOAT
+ v.layer.add(animation, forKey: "radar.transform.rotation.x")
+ }
+ radarImageView.snp.makeConstraints { make in
+ make.size.equalTo(200)
+ make.center.equalToSuperview()
+ }
}
}
+
}
class ScanStateCell: BaseTableViewCell {