71 lines
1.5 KiB
Objective-C
71 lines
1.5 KiB
Objective-C
//
|
|
// TLChatFileHeaderView.m
|
|
// TLChat
|
|
//
|
|
// Created by 李伯坤 on 16/3/18.
|
|
// Copyright © 2016年 李伯坤. All rights reserved.
|
|
//
|
|
|
|
#import "TLChatFileHeaderView.h"
|
|
|
|
@interface TLChatFileHeaderView ()
|
|
|
|
@property (nonatomic, strong) UIView *bgView;
|
|
|
|
@property (nonatomic, strong) UILabel *titleLabel;
|
|
|
|
@end
|
|
|
|
@implementation TLChatFileHeaderView
|
|
|
|
- (id)initWithFrame:(CGRect)frame
|
|
{
|
|
if (self = [super initWithFrame:frame]) {
|
|
[self setBackgroundColor:[UIColor clearColor]];
|
|
[self addSubview:self.bgView];
|
|
[self addSubview:self.titleLabel];
|
|
[self p_addMasonry];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)setTitle:(NSString *)title
|
|
{
|
|
_title = title;
|
|
[self.titleLabel setText:title];
|
|
}
|
|
|
|
#pragma mark - Private Methods -
|
|
- (void)p_addMasonry
|
|
{
|
|
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.mas_equalTo(self);
|
|
}];
|
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.mas_equalTo(self).mas_offset(UIEdgeInsetsMake(0, 10, 0, 10));
|
|
}];
|
|
}
|
|
|
|
#pragma mark - Getter -
|
|
- (UIView *)bgView
|
|
{
|
|
if (_bgView == nil) {
|
|
_bgView = [[UIView alloc] init];
|
|
[_bgView setBackgroundColor:[UIColor colorBlackBG]];
|
|
[_bgView setAlpha:0.8f];
|
|
}
|
|
return _bgView;
|
|
}
|
|
|
|
- (UILabel *)titleLabel
|
|
{
|
|
if (_titleLabel == nil) {
|
|
_titleLabel = [[UILabel alloc] init];
|
|
[_titleLabel setTextColor:[UIColor whiteColor]];
|
|
[_titleLabel setFont:[UIFont systemFontOfSize:14.0f]];
|
|
}
|
|
return _titleLabel;
|
|
}
|
|
|
|
@end
|