wxr
2020-06-16 f6fd8acd7c53c44187e70b4709443318a628f4b5
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
//
//  HDLCoverFlowCell.m
//  CoverFlow
//
//  Created by JLCHEN on 2019/8/26.
//  Copyright © 2019 JLCHEN. All rights reserved.
//
 
#import "HDLCoverFlowCell.h"
 
 
@interface HDLCoverFlowCell ()
 
/**
 *  用于显示通用View
 */
@property (strong, nonatomic) UIView *mCustomView;
 
@end
 
@implementation HDLCoverFlowCell
 
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}
 
#pragma mark - 设置数据 加载自定义ViewCell
- (void)setCustomViewCell:(UIView *)cellView {
 
//    cellView.frame = self.bounds;
////    cellView.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
//    [self.mCustomView removeFromSuperview];
//    self.mCustomView = cellView;
//    [self addSubview:self.mCustomView];
    
 
    //    cellView.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
    [self.mCustomView removeFromSuperview];
    
    self.mCustomView =  [[UIView alloc]initWithFrame:self.bounds];
    
    cellView.center = CGPointMake(self.mCustomView.frame.size.width/2, self.mCustomView.frame.size.height/2);
    [self.mCustomView addSubview:cellView];
    [self addSubview:self.mCustomView];
}
 
#pragma mark - 搭建界面
- (void)setupUI {
    [self.contentView addSubview:self.mCustomView];
}
 
- (UIView *)CustomView{
    if (_mCustomView == nil) {
        _mCustomView = [[UIView alloc]initWithFrame:self.bounds];
        // 设置圆角
        _mCustomView.layer.cornerRadius = 10;
        _mCustomView.layer.masksToBounds = YES;
        // 设置边框颜色
        _mCustomView.layer.borderColor = [UIColor whiteColor].CGColor;
        _mCustomView.layer.borderWidth = 1;
    }
    return _mCustomView;
}
 
 
 
 
@end