//
|
// HDLFVVisitorRecordView.m
|
// Ezviz
|
//
|
// Created by 陈启扬 on 2022/4/29.
|
// Copyright © 2022 hdl. All rights reserved.
|
//
|
|
#import "HDLEZVisitorRecordView.h"
|
#import "HDLEZVisitorRecordCell.h"
|
@implementation HDLEZVisitorRecordView{
|
CGFloat cellHeight;
|
}
|
|
-(instancetype)init{
|
self = [super init];
|
if (self) {
|
self.backgroundColor = HDLEZ_COLOR_VIEW_BACKGROUND;
|
|
self.separatorStyle = NO;
|
self.showsVerticalScrollIndicator=NO;
|
self.delegate = self;
|
self.dataSource = self;
|
cellHeight=92;//根据长度调整
|
[self setSeparatorInset:UIEdgeInsetsZero];
|
// [self setLayoutMargins:UIEdgeInsetsZero];
|
}
|
|
return self;
|
}
|
|
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
return 1;
|
}
|
|
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
return self.temPList.count;
|
}
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
return cellHeight;
|
}
|
|
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
HDLEZLog(@"初始化cell");
|
HDLEZVisitorRecordCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HDLFVVisitorRecordCell"];
|
if(cell == nil){
|
cell=[[HDLEZVisitorRecordCell alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, cellHeight)];
|
}
|
// cell.title=HDLEZLocallizedString(@"Visitor Invitation Record");
|
HDLEZTemInfoModel *model=self.temPList[indexPath.row];
|
cell.tempInfo=model;
|
HDLEZLog(@"初始化cell ID:%@",model.extVisitorId);
|
|
// cell.describe=@"时间:2022年4月29日 16:00 ~ 2022年5月20日 16:00";
|
// cell.describe=[NSString stringWithFormat:@"%@: %@ ~ %@",HDLEZLocallizedString(@"Time"),[self turnDate:model.beginTime],[self turnDate:model.endTime]];
|
return cell;
|
|
}
|
|
//-(NSString *)turnDate:(NSString*)dateStr{
|
// return [HDLEZConstants turnDateString:dateStr toFormater:[NSString stringWithFormat:@"yyyy%@MM%@dd%@ HH:mm",HDLEZLocallizedString(@"Y"),HDLEZLocallizedString(@"M"),HDLEZLocallizedString(@"D")]];
|
//}
|
|
|
|
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
if (self.choseDelegate&&[self.choseDelegate respondsToSelector:@selector(visitorRecordViewdidSelectRecord:)]) {//代理
|
[self.choseDelegate visitorRecordViewdidSelectRecord:self.temPList[indexPath.row]];
|
}
|
}
|
|
|
-(void)setTemPList:(NSArray<HDLEZTemInfoModel *> *)temPList{
|
_temPList=temPList;
|
[self reloadData];
|
}
|
@end
|