LVCMainHeaderCollectionReusableView.m 1.99 KB
//
//  LVCMainHeaderCollectionReusableView.m
//  LiveVideoCloud
//
//  Created by cnliveJunBo on 17/6/20.
//  Copyright © 2017年 cnlive. All rights reserved.
//

#import "LVCMainHeaderCollectionReusableView.h"
#import "JBBannerView.h"
#import "JBAutoRollTableView.h"

@interface LVCMainHeaderCollectionReusableView()

@property (nonatomic, strong) JBBannerView *bannerView;
@property (nonatomic, strong) JBAutoRollTableView *rollTableView;

@end

@implementation LVCMainHeaderCollectionReusableView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.bannerView];
        [self addSubview:self.rollTableView];
    }
    return self;
}

- (void)setBanners:(NSArray *)banners {
    
    if (_banners != banners) {
        _banners = banners;
    }
    _bannerView.bannerArray = banners;
}

#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- (JBBannerView *)bannerView {
    
    if (!_bannerView) {
        _bannerView = [[JBBannerView alloc] initWithFrame:CGRectMake(0, 70, self.bounds.size.width, self.bounds.size.width / 2 + 10)];
        _bannerView.backgroundColor = [UIColor purpleColor];
    }
    return _bannerView;
}

- (JBAutoRollTableView *)rollTableView {
    
    if (!_rollTableView) {
        _rollTableView = [[JBAutoRollTableView alloc] initWithFrame:CGRectMake(39, 250, KScreenWidth-40-25+6, 36) style:UITableViewStylePlain];
        
        NSMutableArray *arrayM = [[NSMutableArray alloc] init];
        ProgramModel *model1 = [[ProgramModel alloc] init];
        model1.title = @"嘉华大厦十大富豪榜";
        [arrayM addObject:model1];
        ProgramModel *model2 = [[ProgramModel alloc] init];
        model2.title = @"思考很久案发的感受";
        [arrayM addObject:model2];
        ProgramModel *model3 = [[ProgramModel alloc] init];
        model3.title = @"模拟电路罚款金额虽";
        [arrayM addObject:model3];
        _rollTableView.news = arrayM;
    }
    return _rollTableView;
}

@end