JLChen
2021-11-04 1443556e9ccb1a19ed8e6710c16c8adc4d4f4fb3
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
//
//  Copyright © 2019 dahua. All rights reserved.
//
 
#import "LCVideoControlView.h"
#import "LCUIKit.h"
 
@implementation LCVideoControlView
 
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
    }
    return self;
}
 
 
- (void)setItems:(NSMutableArray<UIView *> *)items {
    _items = items;
    [self setupView];
}
 
- (void)setupView {
    LCVideotapePlayProcessView * processView = [LCVideotapePlayProcessView new];
    self.processView = processView;
    [processView configPortraitScreenUI];
    processView.hidden = !self.isNeedProcess;
    [self addSubview:processView];
    [processView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.left.top.mas_equalTo(self);
        make.height.mas_equalTo(self.isNeedProcess?23:0);
    }];
    for (int a = 0; a < self.items.count; a++) {
        UIView *tempView = self.items[a];
        [self addSubview:tempView];
       
        if (self.style == LCVideoControlBlackStyle) {
            //黑色控制条
            [tempView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.mas_equalTo(processView.mas_bottom).offset(5);
                make.bottom.mas_equalTo(self).offset(-5);
                make.height.mas_equalTo(30);
                make.width.mas_equalTo(30);
            }];
        } else {
            //白色控制条
            [tempView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.mas_equalTo(processView.mas_bottom).offset(15);
                make.bottom.mas_equalTo(self).offset(-15);
                make.height.mas_equalTo(50);
                make.width.mas_equalTo(50);
            }];
        }
    
    }
        
    if (self.style == LCVideoControlBlackStyle) {
        //黑色控制条
//        [self.items mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:30 leadSpacing:15 tailSpacing:15];
        [self.items mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedItemLength:30 leadSpacing:30 tailSpacing:30];
        self.backgroundColor = [UIColor dhcolor_c50];
    }else{
        //白色控制条
//        [self.items mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:20 leadSpacing:10 tailSpacing:10];
        self.backgroundColor = [UIColor dhcolor_c43];
        [self.items mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedItemLength:50 leadSpacing:40 tailSpacing:40];
    }
}
@end