CNHintView.m
2.38 KB
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
72
73
74
75
76
//
// CNHintView.m
// CNLiveNetAdd
//
// Created by CNLive on 2021/7/13.
// Copyright © 2021 cnlive. All rights reserved.
//
#import "CNHintView.h"
@interface CNHintView ()
@property (nonatomic, strong)UILabel *titleLabel;
@property (nonatomic, strong)UILabel *MessageLabel;
@property (nonatomic, strong)UIButton *closeBtn;
@end
@implementation CNHintView
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.backgroundColor = kWhiteColor;
self.layer.cornerRadius = 8;
[self addSubview:self.titleLabel];
[self addSubview:self.closeBtn];
[self addSubview:self.MessageLabel];
}
return self;
}
#pragma mark - Action
-(void)closeBtnClick
{
[self removeFromSuperview];
}
#pragma mark - Getting
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CNScaleW(15), CNScaleW(15), 60*RATIO, 24*RATIO)];
_titleLabel.text = @"小提示";
_titleLabel.textColor = RGB(51, 51, 51);
_titleLabel.font = UIFontCNMake(17);
_titleLabel.textAlignment = NSTextAlignmentLeft;
}
return _titleLabel;
}
-(UILabel *)MessageLabel
{
if (!_MessageLabel) {
_MessageLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleLabel.left, _titleLabel.bottom+CNScaleW(6), _closeBtn.right, 37*RATIO)];
_MessageLabel.text = @"可以裁剪出人物上半身,脸部不要过小且无遮挡,尺寸请尽量保持4:4或16:9比例,能有效提升修复效果。";
_MessageLabel.textColor = RGB(51, 51, 51);
_MessageLabel.textAlignment = NSTextAlignmentLeft;
_MessageLabel.numberOfLines = 0;
_MessageLabel.font = UIFontCNMake(13);
if ([_MessageLabel separatedLines].count >3) {
_MessageLabel.font = UIFontCNMake(12);
}
[_MessageLabel sizeToFit];
}
return _MessageLabel;
}
- (UIButton *)closeBtn
{
if (!_closeBtn) {
_closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_closeBtn.frame = CGRectMake(self.width - CNScaleW(15) -19*RATIO, _titleLabel.top, 19*RATIO, 19*RATIO);
[_closeBtn setImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"oldPho_tipClose"] forState:UIControlStateNormal];
[_closeBtn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside];
}
return _closeBtn;
}
@end