CNliveCollectionViewCell.m
1005 Bytes
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
//
// CNliveCollectionViewCell.m
// CNLiveVideoClassifyKit_Example
//
// Created by CNLive on 2021/8/7.
// Copyright © 2021 杨苓玉. All rights reserved.
//
#import "CNliveCollectionViewCell.h"
@interface CNliveCollectionViewCell()
@property (nonatomic, strong)UILabel *titleLabel;
@end
@implementation CNliveCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.contentView.backgroundColor = [UIColor lightGrayColor];
[self.contentView addSubview:self.titleLabel];
}
return self;
}
-(void)setTitleName:(NSString *)titleName
{
self.titleLabel.text = titleName;
}
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height)];
_titleLabel.textColor = [UIColor blueColor];
_titleLabel.textAlignment = NSTextAlignmentCenter;
}
return _titleLabel;
}
@end