//
//  HXPublicNomalHUD.m
//  HUD
//
//  Created by 卢悦明 on 2017/3/20.
//  Copyright © 2017年 卢悦明. All rights reserved.
//

#import "GMPublicNomalHUD.h"
#import "GMPublicHUDLogo.h"

@implementation GMPublicNomalHUD
{
    GMPublicHUDLogo *public;
    UILabel *_titleLabel;
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setupUI];

    }
    return self;
}

- (void)setupUI
{
    public = [[GMPublicHUDLogo alloc] init];
    [self addSubview:public];
    
    _titleLabel = [[UILabel alloc] init];
    _titleLabel.textColor = [UIColor colorWithRed:40/255.0 green:40/255.0 blue:40/255.0 alpha:1.0];
    _titleLabel.font = [UIFont systemFontOfSize:12];
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    _titleLabel.hidden = YES;
    [self addSubview:_titleLabel];
}
- (void)layoutSubviews {
    
    CGFloat height = 16;
    _titleLabel.frame = CGRectMake(0, self.frame.size.height - height, self.frame.size.width, height);
    
    public.frame = CGRectMake(13, 0, self.frame.size.width - 26, self.frame.size.height - height - 10);
    
}
- (void)setMessage:(NSString *)message {
    _message = message;
    if (_message != nil && _message.length > 1) {
        _titleLabel.hidden = NO;
        _titleLabel.text = message;
    }
}
- (void)cleanHUD
{
    [public cleanPackView];
    public.hidden = YES;
    public = nil;
    _titleLabel.hidden = YES;
    _titleLabel = nil;
    [self removeFromSuperview];
}
@end
