JLChen
2021-11-29 06c09ecbdf83cc5cc33971ffb75ba81e85b6eb33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
//  HDLSectionHeaderView.m
//  HDLSceneSiriDemo
//
//  Created by 陈嘉乐 on 2021/11/26.
//
 
#import "HDLSectionHeaderView.h"
#import "HDLSceneSiri.h"
 
@implementation HDLSectionHeaderView
 
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.frame = CGRectMake(0, 0, APP_SCREEN_WIDTH, 65);
        self.backgroundColor = UIColor.whiteColor;
        [self addSubview:self.titleLabel];
        [self addSubview:self.messageLabel];
        [self addSubview:self.lineView];
    }
    return self;
}
 
 
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [self NewLabel:CGRectMake(16, 11, APP_SCREEN_WIDTH - 32, 22) font:Get_FontBoldWithSize(16) textColor:HEXCOLORA(0x4484F4, 1.0) text:@""];
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}
 
- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [self NewLabel:CGRectMake(16, 37, APP_SCREEN_WIDTH - 32, 17) font:Get_FontWithSize(12) textColor:HEXCOLORA(0xC0C7D4, 1.0) text:@""];
        _messageLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _messageLabel;
}
 
-(UIView*)lineView{
    if(!_lineView){
        _lineView = [[UIView alloc]initWithFrame:CGRectMake(16, 64, APP_SCREEN_WIDTH - 16, 1)];
        _lineView.backgroundColor = HEXCOLORA(0xECEDEE , 1.0);
    }
    return _lineView;
}
 
- (UILabel *)NewLabel:(CGRect)frame font:(UIFont *)font textColor:(UIColor *)color text:(NSString *)text{
    UILabel *label = [[UILabel alloc] initWithFrame:frame];
    label.backgroundColor = [UIColor clearColor];
    label.font = font;
    if (color != nil) {
        label.textColor = color;
    }
    label.text = text;
    
    return label;
}
 
//
-(void)backButtonClick{
    
}
 
-(void)setTitle:(NSString *)title{
    self.titleLabel.text = title;
}
@end