// // HDLEZDeviceMsgListView.m // EZSDK // // Created by 陈启扬 on 2023/3/16. // #import "HDLEZDeviceMsgListView.h" #import "HDLEZDeviceMsgCell.h" @implementation HDLEZDeviceMsgListView{ CGFloat cellHeight; } -(instancetype)init{ self = [super init]; if (self) { self.backgroundColor = HDLEZ_COLOR_VIEW_BACKGROUND; // self.backgroundColor = [UIColor greenColor]; self.separatorStyle = NO; self.showsVerticalScrollIndicator=NO; self.delegate = self; self.dataSource = self; cellHeight=65; [self setSeparatorInset:UIEdgeInsetsZero]; // [self setLayoutMargins:UIEdgeInsetsZero]; } return self; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return _msgList.count; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return cellHeight; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ HDLEZLog(@"初始化cell"); HDLEZDeviceMsgCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HDLEZDeviceMsgCell"]; if(cell == nil){ cell=[[HDLEZDeviceMsgCell alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, cellHeight)]; } HDLEZDeviceMsgInfoModel *model=self.msgList[indexPath.row]; cell.msgInfo=model; // HDLEZLog(@"初始化cell ID:%@",model.extVisitorId); return cell; } /*设置消息列表值 */ -(void)setMsgList:(NSArray *)msgList{ _msgList=msgList; [self reloadData]; } @end