增加换肤功能
This commit is contained in:
64
QXLive/Base/QXBadgeButton.m
Normal file
64
QXLive/Base/QXBadgeButton.m
Normal file
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// QXBadgeButton.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/28.
|
||||
//
|
||||
|
||||
#import "QXBadgeButton.h"
|
||||
|
||||
@implementation QXBadgeButton
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self addSubview:self.unreadView];
|
||||
[self.unreadView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self);
|
||||
make.right.equalTo(self);
|
||||
make.width.mas_equalTo(kScale375(17));
|
||||
make.height.mas_equalTo(kScale375(17));
|
||||
}];
|
||||
|
||||
|
||||
[self.unreadView.unReadLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.unreadView);
|
||||
make.size.mas_equalTo(self.unreadView.unReadLabel);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self addSubview:self.unreadView];
|
||||
[self.unreadView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self);
|
||||
make.right.equalTo(self);
|
||||
make.width.mas_equalTo(kScale375(17));
|
||||
make.height.mas_equalTo(kScale375(17));
|
||||
}];
|
||||
|
||||
|
||||
[self.unreadView.unReadLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.unreadView);
|
||||
make.size.mas_equalTo(self.unreadView.unReadLabel);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(TUIUnReadView *)unreadView{
|
||||
if (!_unreadView) {
|
||||
_unreadView = [[TUIUnReadView alloc] init];
|
||||
_unreadView.userInteractionEnabled = NO;
|
||||
[_unreadView setNum:0];
|
||||
|
||||
[_unreadView.unReadLabel sizeToFit];
|
||||
|
||||
_unreadView.layer.cornerRadius = kScale375(10);
|
||||
[_unreadView.layer masksToBounds];
|
||||
}
|
||||
return _unreadView;
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user