// // 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