萤石云 iOSSDK,移植跨平台相关工程
Davin
2023-06-15 011b0cc918bfa0e36a9ad4a0f45c18b801815920
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
//  HDLEZDeviceMsgListView.m
//  EZSDK
//
//  Created by 陈启扬 on 2023/3/16.
//
 
#import "HDLEZDeviceMsgListView.h"
#import "HDLEZDeviceMsgCell.h"
#import "HDLEZVideoDoorMsgCell.h"
 
@interface HDLEZDeviceMsgListView ()
 
@property (copy, nonatomic) void(^previewPic)(NSString *pictureUrl);
 
@end
 
@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=80;
        [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");
    HDLEZVideoDoorMsgCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HDLEZVideoDoorMsgCell"];
    if(cell == nil){
        cell=[[HDLEZVideoDoorMsgCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"HDLEZVideoDoorMsgCell"];
    }
    [self configCell:cell indexPath:indexPath];
//    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)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.msgList.count <= indexPath.row) return;
    HDLEZDeviceMsgInfoModel *messageModel = self.msgList[indexPath.row];
#warning mock
    NSString *tempPicUrl = @"https://upload-images.jianshu.io/upload_images/5809200-a99419bb94924e6d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240";
    if (self.previewPic) {
        self.previewPic(tempPicUrl);
    }
}
 
#pragma mark - PublishMethod
- (void)previewPicture:(void(^)(NSString *pictureUrl))previewPic {
    self.previewPic = previewPic;
}
 
#pragma mark - PrivateMethod
- (void)configCell:(HDLEZVideoDoorMsgCell *)cell indexPath:(NSIndexPath *)indexPath {
    if (self.msgList.count <= indexPath.row) return;
    
    HDLEZDeviceMsgInfoModel *messageModel = self.msgList[indexPath.row];
#warning mock
    NSString *tempPicUrl = @"https://upload-images.jianshu.io/upload_images/5809200-a99419bb94924e6d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240";
    [cell configMessageInfoWithTitle:messageModel.title deviceStatus:@"未接听" messageTime:messageModel.createTime messageImage:tempPicUrl];
}
 
/*设置消息列表值
 */
-(void)setMsgList:(NSArray<HDLEZDeviceMsgInfoModel *> *)msgList{
    _msgList=msgList;
    [self reloadData];
}
@end