视频选择条Cell实现,并添加选中蓝色边框

思路:另外写一个UIView,点击时改变其Center

-(UIScrollView *)videoScrollSelectView:(NSArray *)videoView{
    if (!_videoScrollSelectView) {
        _videoScrollSelectView  = [[UIScrollView alloc] init];
        _videoScrollSelectView.frame = CGRectMake(0, 0, HHBWIDTH, 88);
        _videoScrollSelectView.backgroundColor = [UIColor whiteColor];
        _videoScrollSelectView.showsHorizontalScrollIndicator = NO;
        [self.contentView addSubview:_videoScrollSelectView];
        
        //选中边框
        _videoBorderView = [[UIView alloc] init];
        _videoBorderView.size = CGSizeMake(122, 70);
        _videoBorderView.backgroundColor = [UIColor clearColor];
        _videoBorderView.userInteractionEnabled = NO;
        _videoBorderView.layer.masksToBounds = YES;
        _videoBorderView.layer.borderColor = mainColor.CGColor;
        _videoBorderView.layer.borderWidth = 1.0;
        [_videoScrollSelectView addSubview:_videoBorderView];
        
        for (int i=0; i
//点击时改变边框center
-(void)selectVideo:(UIGestureRecognizer *)UIGestureRecognizer{
    if (self.delegate && [self.delegate respondsToSelector:@selector(selectVideo:)]) {
        _videoBorderView.center = UIGestureRecognizer.view.center;
        [self.delegate selectVideo:UIGestureRecognizer.view.tag];
    }
}

你可能感兴趣的:(视频选择条Cell实现,并添加选中蓝色边框)