// // YMChatNotificationSectionHeaderView.m // MSYOUPAI // // Created by YoMi on 2024/2/22. // Copyright © 2024 MS. All rights reserved. // #import "YMChatNotificationSectionHeaderView.h" #import "YMChatNotificationSectionViewModel.h" @interface YMChatNotificationSectionHeaderView () /// 消息通知-分组VM @property (nonatomic, strong) YMChatNotificationSectionViewModel *viewModel; /// 基础视图 @property (nonatomic, strong) UIView *baseView; /// 功能标签 @property (nonatomic, strong) UILabel *functionsLb; @end @implementation YMChatNotificationSectionHeaderView - (void)ym_setupViews{ self.contentView.backgroundColor = UIColor.clearColor; [self.contentView addSubview:self.baseView]; [self.baseView addSubview:self.functionsLb]; [self setNeedsUpdateConstraints]; [self updateConstraintsIfNeeded]; } - (void)updateConstraints{ [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView); make.left.equalTo(self.contentView); make.right.equalTo(self.contentView); make.bottom.equalTo(self.contentView); }]; [self.functionsLb mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.baseView.mas_centerY); make.left.equalTo(self.baseView).offset(adapt(15)); make.right.equalTo(self.baseView).offset(adapt(-15)); }]; [super updateConstraints]; } - (void)ym_bindViewModel:(YMChatNotificationSectionViewModel *)viewModel{ if (!viewModel) { return; } _viewModel = viewModel; self.functionsLb.text = self.viewModel.sectionHeader; } - (UIView *)baseView{ if (!_baseView) { _baseView = [[UIView alloc]init]; _baseView.backgroundColor = HexColorFromRGB(0xF6F6F6); } return _baseView; } - (UILabel *)functionsLb{ if (!_functionsLb) { _functionsLb = [[UILabel alloc]init]; _functionsLb.font = LCFont(11); _functionsLb.textColor = HexColorFromRGB(0x969698); _functionsLb.textAlignment = NSTextAlignmentLeft; _functionsLb.numberOfLines = 3; _functionsLb.text = @"******"; } return _functionsLb; } @end