From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001
From: 单军华
Date: Wed, 11 Jul 2018 10:47:42 +0800
Subject: [PATCH] 首次上传
---
screendisplay/screendisplay/Classes/检测/View/DetailItemCell.m | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 161 insertions(+), 0 deletions(-)
diff --git "a/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/View/DetailItemCell.m" "b/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/View/DetailItemCell.m"
new file mode 100644
index 0000000..82961ea
--- /dev/null
+++ "b/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/View/DetailItemCell.m"
@@ -0,0 +1,161 @@
+//
+// DetailItemCell.m
+// WeSugar
+//
+// Created by ��������� on 2018/7/6.
+// Copyright �� 2018��� ���������. All rights reserved.
+//
+
+#import "DetailItemCell.h"
+#import "GradientProgressView.h"
+
+@interface DetailItemCell ()
+
+
+
+/**
+ ������������
+ */
+@property (nonatomic, strong) UILabel * NameLabel;
+
+/**
+ ���������
+ */
+@property (nonatomic, strong) GradientProgressView * pPregressView;
+
+/**
+ ���������
+ */
+@property (nonatomic, strong) UILabel * currentValueLabel;
+
+/**
+ ������
+ */
+@property (nonatomic, strong) UILabel * UnitLabel;
+
+
+@end
+
+@implementation DetailItemCell
+
+- (GradientProgressView *)pPregressView
+{
+ if (!_pPregressView)
+ {
+ _pPregressView = [[GradientProgressView alloc] initWithFrame:CGRectMake(0, 0, 300, 20)];
+ _pPregressView.colorArr = @[(id)HexColor(0x00a445).CGColor, (id)HexColor(0x23d9a0).CGColor, (id)HexColor(0x00ffde).CGColor];
+ _pPregressView.progress = 0.00;
+ _pPregressView.bgProgressColor = RgbColor(24, 70, 149);
+ [self.contentView addSubview:_pPregressView];
+ }
+
+ return _pPregressView;
+}
+
+
+- (UILabel *)NameLabel
+{
+ if (!_NameLabel)
+ {
+ _NameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 60)];
+ _NameLabel.font = AdaptedFontSize(10);
+ _NameLabel.textColor = [UIColor whiteColor];
+ _NameLabel.textAlignment = NSTextAlignmentRight;
+ [self.contentView addSubview:_NameLabel];
+ }
+
+ return _NameLabel;
+}
+
+- (UILabel *)currentValueLabel
+{
+ if (!_currentValueLabel)
+ {
+ _currentValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 60)];
+ _currentValueLabel.font = AdaptedFontSize(10);
+ _currentValueLabel.textColor = [UIColor whiteColor];
+ _currentValueLabel.textAlignment = NSTextAlignmentLeft;
+ [self.contentView addSubview:_currentValueLabel];
+ }
+
+ return _currentValueLabel;
+}
+
+- (UILabel *)UnitLabel
+{
+ if (!_UnitLabel)
+ {
+ _UnitLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 60)];
+ _UnitLabel.font = AdaptedFontSize(10);
+ _UnitLabel.textColor = [UIColor whiteColor];
+ _UnitLabel.textAlignment = NSTextAlignmentLeft;
+ [self.contentView addSubview:_UnitLabel];
+ }
+
+ return _UnitLabel;
+}
+
+// ������UI������
+- (void)layoutSubviews
+{
+ [super layoutSubviews];
+
+ self.NameLabel.frame = CGRectMake(AdaptedWidth(10), AdaptedHeight(7), AdaptedWidth(50), AdaptedHeight(14));
+ self.pPregressView.frame = CGRectMake(AdaptedWidth(10+50+10), AdaptedHeight(7),AdaptedWidth(150), AdaptedHeight(14));
+ self.currentValueLabel.frame = CGRectMake(AdaptedWidth(10+50+10+150+10), AdaptedHeight(7), AdaptedWidth(40), AdaptedHeight(14));
+ self.UnitLabel.frame = CGRectMake(AdaptedWidth(10+50+10+150+10+40+5), AdaptedHeight(7), AdaptedWidth(60), AdaptedHeight(14));
+}
+
++ (instancetype)topicCellWithTableView:(UITableView *)tableView
+{
+ DetailItemCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([self class])];
+ if (cell == nil)
+ {
+ cell = [[DetailItemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([self class])];
+ cell.backgroundColor = [UIColor clearColor];
+ }
+ return cell;
+}
+
+- (void)setDetailViewModel:(DetailModel *)detailViewModel
+{
+ _detailViewModel = detailViewModel;
+
+ // Model
+ self.NameLabel.text = _detailViewModel.name;
+
+ self.UnitLabel.text = [NSString stringWithFormat:@"(%@)",detailViewModel.unit];
+
+ self.currentValueLabel.text = detailViewModel.value;
+
+ CGFloat progress = (([detailViewModel.value floatValue]-[detailViewModel.lower floatValue])/([detailViewModel.upper floatValue] -[detailViewModel.lower floatValue]));
+
+ self.pPregressView.progress = progress;
+}
+
+// ���������������������������
+- (void)setupTopicCellUIOnce
+{
+// self.contentTextLabel.font = AdaptedFontSize(16);
+//
+// self.headerImageView.layer.cornerRadius = 25;
+// self.headerImageView.layer.masksToBounds = YES;
+
+ self.selectionStyle = UITableViewCellSelectionStyleNone;
+}
+
+- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
+ [self setupTopicCellUIOnce];
+ }
+ return self;
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+ [super setSelected:selected animated:animated];
+
+ // Configure the view for the selected state
+}
+
+@end
--
Gitblit v1.8.0