//
|
// IdleDeviceCell.m
|
// istanbul
|
//
|
// Created by WindShan on 2017/6/16.
|
// Copyright © 2017年 WindShan. All rights reserved.
|
//
|
|
#import "IdleDeviceCell.h"
|
#import "GloriaLabel.h"
|
|
@interface IdleDeviceCell()
|
{
|
|
}
|
|
@property (nonatomic, strong) GloriaLabel * deviceName;
|
@property (nonatomic, strong) GloriaLabel * deviceStatus;
|
@property (nonatomic, strong) UIImageView * imageTag;
|
@end
|
|
@implementation IdleDeviceCell
|
|
/*
|
// Only override drawRect: if you perform custom drawing.
|
// An empty implementation adversely affects performance during animation.
|
- (void)drawRect:(CGRect)rect {
|
// Drawing code
|
}
|
*/
|
|
- (void)layoutSubviews
|
{
|
[super layoutSubviews];
|
|
self.deviceName.frame = CGRectMake(20, 10, SCREEN_WIDTH/2, 40);
|
self.deviceStatus.frame = CGRectMake(20+SCREEN_WIDTH/2+24+10, 10, SCREEN_WIDTH/2, 40);
|
self.imageTag.frame = CGRectMake(20+SCREEN_WIDTH/2, 18, 24, 24);
|
}
|
|
- (UIImageView *)imageTag
|
{
|
if (!_imageTag)
|
{
|
_imageTag = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 60)];
|
[self.contentView addSubview:_imageTag];
|
}
|
|
return _imageTag;
|
}
|
|
- (GloriaLabel *) deviceName
|
{
|
if(!_deviceName)
|
{
|
_deviceName = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)];
|
_deviceName.font = [UIFont systemFontOfSize:16];
|
_deviceName.textAlignment = UITextAlignmentLeft;
|
_deviceName.textColor = kUIColorFromRGB(0xa9a9a9);
|
[self.contentView addSubview:_deviceName];
|
}
|
|
return _deviceName;
|
}
|
|
- (GloriaLabel *) deviceStatus
|
{
|
if(!_deviceStatus)
|
{
|
_deviceStatus = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)];
|
_deviceStatus.font = [UIFont systemFontOfSize:16];
|
_deviceStatus.textAlignment = UITextAlignmentLeft;
|
_deviceStatus.textColor = kUIColorFromRGB(0x5a5a5a);
|
[self.contentView addSubview:_deviceStatus];
|
}
|
|
return _deviceStatus;
|
}
|
|
- (void)setItemView:(DeviceSpareModel*)model
|
{
|
self.imageTag.image = [UIImage imageNamed:model.status == 0?@"spare1":@"spare2"];
|
[self.deviceName setText:model.name];
|
[self.deviceStatus setText:model.status == 0?@"闲置":@"使用"];
|
}
|
|
@end
|