From 21d3023a9b7b6aff68c1170e345951396b1c6cfd Mon Sep 17 00:00:00 2001
From: 单军华
Date: Tue, 31 Jul 2018 13:35:21 +0800
Subject: [PATCH] no message

---
 screendisplay/screendisplay/Classes/检测/View/DetailItemCell.m |  180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 180 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..b130042
--- /dev/null
+++ "b/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/View/DetailItemCell.m"
@@ -0,0 +1,180 @@
+//
+//  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];
+
+    if([StringUtil isPureFloat:detailViewModel.value] && ![StringUtil isPureInt:detailViewModel.value])
+    {
+        detailViewModel.value = [NSString stringWithFormat:@"%.2f",[detailViewModel.value floatValue]];
+    }
+    
+    self.currentValueLabel.text = detailViewModel.value;
+    
+    //e17
+    if([_detailViewModel.sensor_key isEqualToString:@"e17"])
+    {
+        _NameLabel.font = AdaptedFontSize(9);
+    }
+    else
+    {
+        _NameLabel.font = AdaptedFontSize(10);
+    }
+    
+    CGFloat progress = 0.0;
+    if([detailViewModel.upper floatValue] != 0)
+    {
+        progress = ([detailViewModel.value floatValue]/[detailViewModel.upper 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