//
//  HJMHStatusBar.m
//  prankPro
//
//  Created by mac on 16/1/25.
//  Copyright 漏 2016骞?huijimuhe. All rights reserved.
//

#import "HJMHStatusBar.h"

@implementation HJMHStatusBar


-(void)SetStatusWithPlay:(int)playCount andLike:(int)likeCount{
    self.play_count.text=[NSString stringWithFormat:@"%d", playCount];
    self.like_count.text=[NSString stringWithFormat:@"%d", likeCount];
}

-(instancetype)init{
    if(self=[super init]){
        [self initViews];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        [self initViews];
    }
    return self;
}

-(void)initViews{
    //鎾斁娆℃暟
    UIImageView* iconPlay=[[UIImageView alloc]init];
    iconPlay.image=[UIImage imageNamed:@"play"];
    
    [self addSubview:iconPlay];
    [self addSubview:self.play_count];
    
    [iconPlay makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(self);
        make.size.equalTo(15);
    }];
    [self.play_count makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.left.equalTo(iconPlay.mas_right).offset(5);
    }];
    
    //鐐硅禐鏁伴噺
    UIImageView* iconLike=[[UIImageView alloc]init];
    iconLike.image=[UIImage imageNamed:@"like"];
    [self addSubview:iconLike];
    [self addSubview:self.like_count];
    
    [iconLike makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.left.equalTo(self.play_count.mas_right).offset(25);
        make.size.equalTo(15);
    }];
    
    [self.like_count makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.left.equalTo(iconLike.mas_right).offset(5);
    }];
}

#pragma lazy load
-(UILabel*) play_count{
    if(_play_count==nil){
        _play_count=[[UILabel alloc]init];
        _play_count.textColor =kSubTextColor;
        _play_count.font = [UIFont fontWithName:@"HelveticaNeue" size:13];
    }
    return _play_count;
}

-(UILabel*) like_count{
    if(_like_count==nil){
        _like_count=[[UILabel alloc]init];
        _like_count.textColor =kSubTextColor;
        _like_count.font = [UIFont fontWithName:@"HelveticaNeue" size:13];
    }
    return _like_count;
}

@end
// 鐗堟潈灞炰簬鍘熶綔鑰?// http://code4app.com (cn) http://code4app.net (en)
// 鍙戝竷浠g爜浜庢渶涓撲笟鐨勬簮鐮佸垎浜綉绔? Code4App.com