BackgroundView.m 1.55 KB
//
//  BackgroundView.m
//  QNLiveStreamingDemo
//
//  Created by iOS on 17/4/7.
//  Copyright © 2017年 zhulin. All rights reserved.
//

#import "BackgroundView.h"

@interface BackgroundView ()

@property (nonatomic, strong) UILabel *anchorLab;

@end


@implementation BackgroundView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor blackColor];
        [self addSubview:self.anchorLab];
    }
    return self;
}

- (void)setAnchorStatus:(int)anchorStatus
{
    switch (anchorStatus) {
        case 0:
            self.hidden = YES;
            break;
            
        case 1:
            _anchorLab.text = @"主播已离开,马上回来~";
            self.hidden = NO;
            break;
            
        case 2:
            _anchorLab.text = @"直播已结束";
            self.hidden = NO;
            break;
            
        default:
            break;
    }
}

#pragma mark -
#pragma mark - getter

- (UILabel *)anchorLab
{
    if (!_anchorLab) {
        _anchorLab = [[UILabel alloc] initWithFrame:CGRectMake(0, self.bounds.size.height/2-25, self.bounds.size.width, 40)];
        _anchorLab.textColor = [UIColor whiteColor];
        _anchorLab.font = [UIFont systemFontOfSize:22];
        _anchorLab.textAlignment = NSTextAlignmentCenter;
    }
    return _anchorLab;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end