// // FileDownCell.m // terminalMgr // // Created by WindShan on 2017/3/16. // Copyright © 2017年 WindShan. All rights reserved. // #import "FileDownCell.h" #import "GloriaLabel.h" #import "UIImageView+WebCache.h" #import "commenProgressView.h" @interface FileDownCell() { } @property (nonatomic, strong) UIImageView * file_havedown_item_bk; @property (nonatomic, strong) GloriaLabel * fileName; @property (nonatomic, strong) GloriaLabel * fileDownTime; @property (nonatomic, strong) UIButton * startBtn; // 查看 @property (nonatomic, strong) UIButton * deleteBtn; @end @implementation FileDownCell /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ -(void)lookAction { if ( _delegate && [_delegate respondsToSelector:@selector(didCellHandleSection:)]) { self.model.handleCmd = @"4"; [_delegate didCellHandleSection:self.model]; } } -(void)deleteAction { if ( _delegate && [_delegate respondsToSelector:@selector(didCellHandleSection:)]) { self.model.handleCmd = @"3"; [_delegate didCellHandleSection:self.model]; } } -(UIButton*)deleteBtn { if(!_deleteBtn) { _deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _deleteBtn.frame = CGRectMake(0, SCREEN_HEIGHT-100, 118, 30); [_deleteBtn setBackgroundImage:[UIImage imageNamed:@"file_havedown_delete_btn" ] forState:UIControlStateNormal]; [_deleteBtn setTitle:@"删除" forState:UIControlStateNormal]; [_deleteBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; //_deleteBtn.backgroundColor = [UIColor redColor]; //上左下右 _deleteBtn.tag = 100; _deleteBtn.titleLabel.font = [UIFont systemFontOfSize: 12.0]; [_deleteBtn addTarget:self action:@selector(deleteAction) forControlEvents:UIControlEventTouchUpInside]; //[_deleteBtn setTintColor:RgbColor(253,137,8)]; [self.contentView addSubview:_deleteBtn]; } return _deleteBtn; } -(UIButton*)startBtn { if(!_startBtn) { _startBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _startBtn.frame = CGRectMake(0, SCREEN_HEIGHT-100, 118, 30); [_startBtn setBackgroundImage:[UIImage imageNamed:@"file_havedown_look_btn" ] forState:UIControlStateNormal]; [_startBtn setTitle:@"查看" forState:UIControlStateNormal]; [_startBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; //_startBtn.backgroundColor = [UIColor redColor]; //上左下右 _startBtn.tag = 101; _startBtn.titleLabel.font = [UIFont systemFontOfSize: 12.0]; [_startBtn addTarget:self action:@selector(lookAction) forControlEvents:UIControlEventTouchUpInside]; //[_startBtn setTintColor:RgbColor(253,137,8)]; [self.contentView addSubview:_startBtn]; } return _startBtn; } - (GloriaLabel *) fileName { if(!_fileName) { _fileName = [[GloriaLabel alloc] initWithFrame:CGRectMake(8+10+45, 5,SCREEN_WIDTH/2, 30)]; _fileName.font = [UIFont systemFontOfSize:14]; _fileName.textAlignment = UITextAlignmentLeft; _fileName.textColor = kUIColorFromRGB(0x6e6e6e); [self.contentView addSubview:_fileName]; } return _fileName; } - (GloriaLabel *) fileDownTime { if(!_fileDownTime) { _fileDownTime = [[GloriaLabel alloc] initWithFrame:CGRectMake(8+10+45, 5,SCREEN_WIDTH/2, 30)]; _fileDownTime.font = [UIFont systemFontOfSize:12]; _fileDownTime.textAlignment = UITextAlignmentLeft; _fileDownTime.textColor = kUIColorFromRGB(0xa9a9a9); [self.contentView addSubview:_fileDownTime]; } return _fileDownTime; } - (UIImageView *)file_havedown_item_bk { if (!_file_havedown_item_bk) { _file_havedown_item_bk = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5, SCREEN_WIDTH-16, 70)]; [self.contentView addSubview:_file_havedown_item_bk]; } return _file_havedown_item_bk; } //@property (nonatomic, strong) UIImageView * bkImage; //@property (nonatomic, strong) UIImageView * iconImage; //@property (nonatomic, strong) UIImageView * nameCircleImage; //@property (nonatomic, strong) UIImageView * statusCircleImage; //@property (nonatomic, strong) GloriaLabel * deviceName; //@property (nonatomic, strong) GloriaLabel * FileStatus; - (void)layoutSubviews { [super layoutSubviews]; CGFloat bkImageW = 271; if(IsiPhone4 || IsiPhone5) { bkImageW = 230; } // 271 self.file_havedown_item_bk.frame = CGRectMake((SCREEN_WIDTH-bkImageW-45*2-4)/2, 5, bkImageW, 55); self.fileName.frame = CGRectMake((SCREEN_WIDTH-bkImageW-45*2-4)/2+10, 15, bkImageW-20, 20); self.fileDownTime.frame = CGRectMake((SCREEN_WIDTH-bkImageW-45*2-4)/2+10, 35, bkImageW-20, 20); self.startBtn.frame = CGRectMake((SCREEN_WIDTH-bkImageW-45*2-4)/2+bkImageW+1, 5, 45, 55); // 45 self.deleteBtn.frame = CGRectMake((SCREEN_WIDTH-bkImageW-45*2-4)/2+bkImageW+1+1+45, 5, 45, 55); } /** 设置数据*/ - (void)setItemView:(FileStatus*)model { self.model = model; self.contentView.backgroundColor = [UIColor clearColor]; self.file_havedown_item_bk.image = [UIImage imageNamed:@"file_havedown_item_bk"]; [self.fileName setText:[NSString stringWithFormat:@"文件名:%@",self.model.name]]; [self.fileDownTime setText: [DateUtil stringFromLong:self.model.created]]; } @end