// // RQSpecialPointCell.m // jiaPei // // Created by 张嵘 on 2022/6/22. // Copyright © 2022 JCZ. All rights reserved. // #import "RQSpecialPointCell.h" @interface RQSpecialPointCell () @property (nonatomic, readwrite, strong) RQSpecialPointItemViewModel *viewModel; @property (weak, nonatomic) IBOutlet UIButton *numBtn; @property (weak, nonatomic) IBOutlet UILabel *myTitleLabel; @property (weak, nonatomic) IBOutlet UILabel *mySubTitleLabel; @end @implementation RQSpecialPointCell #pragma mark - PublicMethods + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath { static NSString *ID = @"RQSpecialPointCell"; [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID]; RQSpecialPointCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath]; if (!cell) cell = [self rq_viewFromXib]; cell.numBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(18.f) / 2.f; return cell; } - (void)bindViewModel:(RQSpecialPointItemViewModel *)viewModel { _viewModel = viewModel; [_numBtn setTitleNormal:viewModel.numStr]; _myTitleLabel.text = viewModel.title; RAC(self.mySubTitleLabel, text) = [[[RACObserve(viewModel, subtitle) deliverOnMainThread] map:^id _Nullable(id _Nullable value) { return RQStringIsEmpty(viewModel.subtitle)? @"..." : viewModel.subtitle; }] takeUntil:self.rac_prepareForReuseSignal]; } #pragma mark - SystemMethods - (void)awakeFromNib { [super awakeFromNib]; } @end