Commit a626ee2ad046b799e4f7afe14d2419dbf2bf4f0f

Authored by 王军波
1 parent 73e31a2d

自定义cell

LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCBackgroundView.m
... ... @@ -57,8 +57,7 @@
57 57 }
58 58 }
59 59  
60   -#pragma mark - getter !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
61   -
  60 +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
62 61 - (UIImageView *)iconView {
63 62  
64 63 if (!_iconView) {
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.m
... ... @@ -8,14 +8,33 @@
8 8  
9 9 #import "LVCUGCLivePlayerCell.h"
10 10  
  11 +@interface LVCUGCLivePlayerCell()
  12 +
  13 +@property (nonatomic, strong) UIImageView *iconView;
  14 +
  15 +@property (nonatomic, strong) UILabel *nameLabel;
  16 +
  17 +@property (nonatomic, strong) UILabel *locationLabel;
  18 +
  19 +@property (nonatomic, strong) UILabel *countLabel;
  20 +
  21 +@property (nonatomic, strong) UIImageView *imageView;
  22 +
  23 +@property (nonatomic, strong) UILabel *stateLabel;
  24 +
  25 +@property (nonatomic, strong) UILabel *titleLabel;
  26 +
  27 +@end
  28 +
11 29 @implementation LVCUGCLivePlayerCell
12 30  
13   -- (instancetype)initWithFrame:(CGRect)frame
14   -{
  31 +- (instancetype)initWithFrame:(CGRect)frame {
  32 +
15 33 self = [super initWithFrame:frame];
16 34 if (self) {
17 35 self.contentView.backgroundColor = [UIColor whiteColor];
18   -
  36 + [self.contentView addSubview:self.iconView];
  37 + [self.contentView addSubview:self.nameLabel];
19 38 }
20 39 return self;
21 40 }
... ... @@ -29,6 +48,60 @@
29 48 }
30 49  
31 50 #pragma mark - SetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  51 +- (UIImageView *)iconView {
  52 +
  53 + if (!_iconView) {
  54 + NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"];
  55 + UIImage *image = [UIImage imageWithContentsOfFile:path];
  56 + _iconView = [[UIImageView alloc] initWithImage:image];
  57 + _iconView.frame = CGRectMake(10, 10, 50, 50);
  58 + _iconView.layer.cornerRadius = 25;
  59 + _iconView.layer.masksToBounds = YES;
  60 + }
  61 + return _iconView;
  62 +}
32 63  
  64 +- (UILabel *)nameLabel {
  65 + if (!_nameLabel) {
  66 + _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, 10, SCREEN_WIDTH - 100, 20)];
  67 + _nameLabel.text = @"这是我的昵称";
  68 + }
  69 + return _nameLabel;
  70 +}
  71 +
  72 +- (UILabel *)locationLabel {
  73 + if (!_locationLabel) {
  74 +
  75 + }
  76 + return _locationLabel;
  77 +}
  78 +
  79 +- (UILabel *)countLabel {
  80 + if (!_countLabel) {
  81 +
  82 + }
  83 + return _countLabel;
  84 +}
  85 +
  86 +- (UIImageView *)imageView {
  87 + if (!_imageView) {
  88 +
  89 + }
  90 + return _imageView;
  91 +}
  92 +
  93 +- (UILabel *)stateLabel {
  94 + if (!_stateLabel) {
  95 +
  96 + }
  97 + return _stateLabel;
  98 +}
  99 +
  100 +- (UILabel *)titleLabel {
  101 + if (!_titleLabel) {
  102 +
  103 + }
  104 + return _titleLabel;
  105 +}
33 106  
34 107 @end
... ...