LVCUGCPlayerLoadingView.m 1.28 KB
//
//  LVCUGCPlayerLoadingView.m
//  LiveVideoCloud
//
//  Created by cnliveJunBo on 17/3/20.
//  Copyright © 2017年 cnlive. All rights reserved.
//

#import "LVCUGCPlayerLoadingView.h"
#import "UIImage+LVCVagueImage.h"

@interface LVCUGCPlayerLoadingView() {
    
    NSString *_bgImageURLStr;
}

@property (nonatomic, strong) UIImageView *bgImageView;

@end

@implementation LVCUGCPlayerLoadingView

- (instancetype)initWithFrame:(CGRect)frame bgImageURLStr:(NSString *)bgImageURLStr
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        _bgImageURLStr = bgImageURLStr;
        [self addSubview:self.bgImageView];
    }
    return self;
}

- (UIImageView *)bgImageView {
    if (!_bgImageView) {
        
        NSString *path = [[NSBundle mainBundle] pathForResource:@"UGCLoading" ofType:@"jpeg"];
        UIImage *image = [UIImage imageWithContentsOfFile:path];
        UIImage *blurImage = [UIImage boxblurImage:image withBlurNumber:0.6];
        _bgImageView = [[UIImageView alloc] initWithImage:blurImage];
        _bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        _bgImageView.contentMode = UIViewContentModeScaleAspectFill;
        _bgImageView.clipsToBounds = YES;
    }
    return _bgImageView;
}

@end