萤石云 iOSSDK,移植跨平台相关工程
JLChen
2021-02-02 9100afbe1805413504840e6957097be638579045
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
//
//  EZLocalCameraListViewController.m
//  EZOpenSDKDemo
//
//  Created by linyong on 2017/8/16.
//  Copyright © 2017年 Ezviz. All rights reserved.
//
 
#import "EZLocalCameraListViewController.h"
#import "EZHCNetDeviceInfo.h"
#import "EZLocalRealPlayViewController.h"
 
#define CAMERA_LIST_ID @"CAMERA_LIST_ID"
#define HEADER_HEIGHT (30)
#define CELL_HEIGHT (50)
 
@interface EZLocalCameraListViewController ()
 
@property (nonatomic,assign) NSInteger cameraNo;
 
@end
 
@implementation EZLocalCameraListViewController
 
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.title = NSLocalizedString(@"device_camera_list_title", @"设备通道列表");
    self.tableView.tableFooterView = [UIView new];
    
    // Do any additional setup after loading the view.
}
 
 
#pragma mark - override
 
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}
 
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue destinationViewController] isKindOfClass:[EZLocalRealPlayViewController class]])
    {
        EZLocalRealPlayViewController *VC = (EZLocalRealPlayViewController *)[segue destinationViewController];
        VC.deviceInfo = self.deviceInfo;
        VC.cameraNo = self.cameraNo;
    }
}
 
#pragma mark - delegate
 
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;//模拟通道列表和数字通道列表
}
 
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return HEADER_HEIGHT;
}
 
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    NSString *str = nil;
    if (section == 0)
    {
        str = NSLocalizedString(@"device_analogue_camera", @"模拟通道");
    }
    else
    {
        str = NSLocalizedString(@"device_digital_camera", @"数字通道");
    }
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, HEADER_HEIGHT)];
    view.backgroundColor = [UIColor colorWithWhite:0.6 alpha:0.7];
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 200, HEADER_HEIGHT)];
    title.text = str;
    title.font = [UIFont boldSystemFontOfSize:14.0];
    title.backgroundColor = [UIColor clearColor];
    
    [view addSubview:title];
    
    return view;
}
 
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (!self.deviceInfo)
    {
        return 0;
    }
    
    if (section == 0)
    {
        return self.deviceInfo.channelCount;
    }
    
    return self.deviceInfo.dChannelCount;
}
 
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return CELL_HEIGHT;
}
 
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CAMERA_LIST_ID];
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CAMERA_LIST_ID];
    }
    
    if ([indexPath section] == 0)
    {
        cell.textLabel.text = [NSString stringWithFormat:@"Camera %02ld",self.deviceInfo.startChannelNo + [indexPath row]];
    }
    else
    {
        cell.textLabel.text = [NSString stringWithFormat:@"Camera %02ld",self.deviceInfo.dStartChannelNo + [indexPath row]];
    }
    
    return cell;
}
 
 
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([indexPath section] == 0)
    {
        self.cameraNo = self.deviceInfo.startChannelNo + [indexPath row];
    }
    else
    {
        self.cameraNo = self.deviceInfo.dStartChannelNo + [indexPath row];
    }
    
    [self go2LocalRealPlay];
}
 
#pragma mark - support
 
- (void) go2LocalRealPlay
{
    if (!self.deviceInfo)
    {
        return;
    }
    
    [self performSegueWithIdentifier:@"cameraList2RealPlay" sender:nil];
}
 
 
@end