ChatQuoteView.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // ChatQuoteView.m
  3. // AIIM
  4. //
  5. // Created by qitewei on 2025/5/26.
  6. //
  7. #import "ChatQuoteView.h"
  8. @implementation ChatQuoteView
  9. - (instancetype)initWithFrame:(CGRect)frame{
  10. if (self= [super initWithFrame:frame]) {
  11. self.backgroundColor = globalColor(GCTypeDark7);
  12. self.layer.cornerRadius = 5.f;
  13. self.layer.masksToBounds = YES;
  14. [self configUI];
  15. }
  16. return self;
  17. }
  18. - (void)configUI{
  19. [self addSubview:self.closeBtn];
  20. [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  21. make.size.mas_equalTo(CGSizeMake(16, 16));
  22. make.centerY.mas_equalTo(self.mas_centerY);
  23. make.right.mas_equalTo(self.mas_right).offset(-8);
  24. }];
  25. [self addSubview:self.quoteContentLbl];
  26. [self.quoteContentLbl mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.height.mas_equalTo(16);
  28. make.left.mas_equalTo(8);
  29. make.right.mas_equalTo(self.closeBtn.mas_left).offset(-8);
  30. make.centerY.mas_equalTo(self.mas_centerY);
  31. }];
  32. }
  33. - (void)setModel:(ChatMessageModel *)model{
  34. _model = model;
  35. self.quoteContentLbl.text = [NSString stringWithFormat:@"%@:%@",model.nickName,model.content];
  36. NSLog(@"1111111-------------");
  37. }
  38. - (UILabel *)quoteContentLbl{
  39. if (!_quoteContentLbl) {
  40. _quoteContentLbl = [UILabel new];
  41. _quoteContentLbl.textColor = globalColor(GCTypeDark3);
  42. _quoteContentLbl.font = SYSFONT(14);
  43. }
  44. return _quoteContentLbl;
  45. }
  46. - (UIButton *)closeBtn{
  47. if (!_closeBtn) {
  48. _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  49. [_closeBtn setBackgroundImage:kImageMake(@"quote_close") forState:UIControlStateNormal];
  50. }
  51. return _closeBtn;
  52. }
  53. @end