52 lines
1.7 KiB
Objective-C
52 lines
1.7 KiB
Objective-C
//
|
|
// MsRoomMessagChatHallHeadView.m
|
|
// YuMi
|
|
//
|
|
// Created by duoban on 2024/6/3.
|
|
//
|
|
|
|
#import "MsRoomMessagChatHallHeadView.h"
|
|
@interface MsRoomMessagChatHallHeadView()
|
|
@property(nonatomic,strong) UILabel *titleView;
|
|
@end
|
|
@implementation MsRoomMessagChatHallHeadView
|
|
|
|
-(instancetype)initWithFrame:(CGRect)frame{
|
|
self = [super initWithFrame:frame];
|
|
if(self){
|
|
[self installUI];
|
|
[self installConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
-(void)installUI{
|
|
self.layer.cornerRadius = 7;
|
|
self.layer.masksToBounds = YES;
|
|
self.layer.borderWidth = 1;
|
|
[self addSubview:self.titleView];
|
|
}
|
|
-(void)installConstraints{
|
|
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(self).offset(10);
|
|
}];
|
|
}
|
|
-(void)setContent:(NSString *)content{
|
|
_content = content;
|
|
_titleView.text = _content;
|
|
[_titleView.superview layoutIfNeeded];
|
|
// UIImage *bgImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xE3B462),UIColorFromRGB(0x723505)] gradientType:GradientTypeLeftToRight imgSize:self.frame.size];
|
|
// self.backgroundColor = [UIColor colorWithPatternImage:bgImage];
|
|
// UIImage *borderImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xF7D364),UIColorFromRGB(0xFFFAE4),UIColorFromRGB(0xF7D364)] gradientType:GradientTypeLeftToRight imgSize:self.frame.size];
|
|
// self.layer.borderColor = [UIColor colorWithPatternImage:borderImage].CGColor;
|
|
}
|
|
#pragma mark - 懒加载
|
|
- (UILabel *)titleView{
|
|
if(!_titleView){
|
|
_titleView = [UILabel labelInitWithText:@"" font:[UIFont systemFontOfSize:13 weight:UIFontWeightMedium] textColor:UIColorFromRGB(0xFFF6E1)];
|
|
_titleView.textAlignment = NSTextAlignmentCenter;
|
|
}
|
|
return _titleView;
|
|
}
|
|
|
|
@end
|