-
Notifications
You must be signed in to change notification settings - Fork 0
/
videoListV.m
66 lines (59 loc) · 1.72 KB
/
videoListV.m
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
//
// videoListV.m
// HymnLens
//
// Created by 陈志浩 on 16/2/13.
// Copyright © 2016年 陈志浩. All rights reserved.
//
#import "videoListV.h"
#import "videoV.h"
@implementation videoListV
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (instancetype)init{
if (self = [super init]){
[self loadConfiguration];
}
return self;
}
- (void)loadConfiguration{
self.showsVerticalScrollIndicator = YES;
self.showsHorizontalScrollIndicator = NO;
self.scrollEnabled = YES;
self.canCancelContentTouches = YES;
}
- (void)setCount:(NSInteger)count{
NSMutableArray * videoMuteArr = [NSMutableArray arrayWithCapacity:count];
NSInteger line, row;
for (int i = 0 ; i < count ; i++){
videoV * subVideoV = [[videoV alloc]init];
subVideoV.tag = i;
[self addSubview:subVideoV];
[videoMuteArr addObject:subVideoV];
}
_videoArr = [NSArray arrayWithArray:videoMuteArr];
NSInteger number = 0;
for (videoV * subVideoV in _videoArr){
line = number / 3 + 1;
row = number % 3 + 1;
[subVideoV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).with.offset(7 * row + (SCREEN_WIDTH
- 28) / 3 * (row - 1));
make.top.equalTo(self.mas_top).with.offset(7 * line + (SCREEN_WIDTH
- 28) / 3 * (line - 1));
make.width
.mas_equalTo([NSNumber numberWithFloat:(SCREEN_WIDTH
- 28) / 3]);
make.height.mas_equalTo([NSNumber numberWithFloat:(SCREEN_WIDTH
- 28) / 3]);
}];
number += 1;
}
_count = count;
}
@end