123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- //
- // JXSheBeiCell.m
- // shiku_im
- //
- // Created by 123 on 2020/5/26.
- // Copyright © 2020 Reese. All rights reserved.
- //
- #import "JXSheBeiCell.h"
- @interface JXSheBeiCell ()
- @property (nonatomic,weak) UILabel *titleL;
- @property (nonatomic,weak) UILabel *subTitle;
- @property (nonatomic,weak) UILabel *searitL;
- @end
- @implementation JXSheBeiCell
-
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
-
- if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
-
- UILabel *titleL=[[UILabel alloc]init];
- titleL.text=@"HUAWEI-AI0-AL00";
- titleL.font=[UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
- [self.contentView addSubview:titleL];
- self.titleL=titleL;
- [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(15);
- make.left.mas_equalTo(15);
- }];
-
-
- UILabel *subTitle=[[UILabel alloc]init];
- subTitle.text=@"20-05-24 03:02:11 ";
- subTitle.textColor=kRGBColor151;
- subTitle.font=[UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
- [self.contentView addSubview:subTitle];
- self.subTitle=subTitle;
- [subTitle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(15);
- make.left.mas_equalTo(titleL.mas_right).mas_offset(11);
- }];
-
-
- UILabel *searitL=[[UILabel alloc]init];
- searitL.text=@"20-05-2403:02:11 ";
- searitL.textColor=kRGBColor151;
- searitL.font=[UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
- [self.contentView addSubview:searitL];
- self.searitL=searitL;
- [searitL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(titleL.mas_bottom).mas_offset(11);
- make.left.mas_equalTo(15);
- }];
-
-
- UIButton *rightIMG=[[UIButton alloc]init];
- [rightIMG setTitle:@"删除" forState:UIControlStateNormal];
- rightIMG.backgroundColor=[UIColor redColor];
- rightIMG.titleLabel.font=[UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
- rightIMG.layer.cornerRadius=5;
- rightIMG.layer.masksToBounds=YES;
- [self.contentView addSubview:rightIMG];
- [rightIMG addTarget:self action:@selector(deleteBtnClick:) forControlEvents:UIControlEventTouchUpInside];
- self.rightIMG=rightIMG;
- [rightIMG mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(self.contentView.mas_centerY);
- make.right.mas_equalTo(-10);
- make.width.mas_equalTo(49);
- make.right.mas_equalTo(30);
- }];
-
-
- }
-
- return self;
- }
- -(void)deleteBtnClick:(UIButton *)sender{
-
- if (_block) {
- _block(sender);
- }
-
- }
- -(void)setModel:(shebeiModel *)Model{
-
- _Model=Model;
- self.titleL.text=[NSString stringWithFormat:@"%@",Model.deviceName];
- self.searitL.text=[NSString stringWithFormat:@"%@",Model.deviceIMSI];
-
- NSDateFormatter *matter = [[NSDateFormatter alloc]init];
- matter.dateFormat =@"YYYY-MM-dd HH:mm";
- NSDate *date = [NSDate dateWithTimeIntervalSince1970:[Model.loginTime doubleValue]/1000];
- NSString*timeStr = [matter stringFromDate:date];
- self.subTitle.text=[NSString stringWithFormat:@"%@",timeStr];
- }
- + (instancetype)cellWithTableView:(UITableView *)tableView
- {
- static NSString *ID = @"JXSheBeiCell";
- JXSheBeiCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
-
- if (!cell) {
- cell = [[JXSheBeiCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
- cell.selectionStyle=UITableViewCellSelectionStyleNone;
- }
- return cell;
- }
- @end
|