// // SearchDeviceCell.m // istanbul // // Created by WindShan on 2017/6/16. // Copyright © 2017年 WindShan. All rights reserved. // #import "SearchDeviceCell.h" #import "GloriaLabel.h" @interface SearchDeviceCell() { } @property (nonatomic, strong) GloriaLabel * deviceName; @property (nonatomic, strong) GloriaLabel * deviceLink; @property (nonatomic, strong) UIImageView * imageTag; @end @implementation SearchDeviceCell /* // 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+20, 10, SCREEN_WIDTH/2, 20); self.deviceLink.frame = CGRectMake(SCREEN_WIDTH-40, 10, SCREEN_WIDTH/3, 20); self.imageTag.frame = CGRectMake(20, 15, 10, 10); } - (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 *) deviceLink { if(!_deviceLink) { _deviceLink = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)]; _deviceLink.font = [UIFont systemFontOfSize:16]; _deviceLink.textAlignment = UITextAlignmentRight; _deviceLink.textColor = kUIColorFromRGB(0x5a5a5a); [self.contentView addSubview:_deviceLink]; } return _deviceLink; } - (void)setItemView:(DeviceSpareModel*)model { self.imageTag.image = [UIImage imageNamed:@"icon_lanya_tag"]; [self.deviceName setText:@"USR-BLE101"]; [self.deviceLink setText:@"链接"]; } @end