12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // NYBlockExerciseHeaderView.m
- // jiaPei
- //
- // Created by Ning.ge on 2024/12/5.
- // Copyright © 2024 JCZ. All rights reserved.
- //
- #import "NYBlockExerciseHeaderView.h"
- @interface NYBlockExerciseHeaderView ()
- @property (nonatomic, readwrite, strong) NYBlockExerciseGroupViewModel *viewModel;
- @end
- @implementation NYBlockExerciseHeaderView
- + (instancetype)reusableViewWithCollectionView:(UICollectionView *)collectionView OfKind:(NSString *)elementKind forIndexPath:(NSIndexPath *)indexPath {
- NSString *ID = [NSString stringWithFormat:@"%@%@", @"NYBlockExerciseHeaderView",elementKind];
- [collectionView registerNib:[UINib nibWithNibName:@"NYBlockExerciseHeaderView" bundle:nil] forSupplementaryViewOfKind:elementKind withReuseIdentifier:ID];
- NYBlockExerciseHeaderView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:ID forIndexPath:indexPath];
- if (!reusableView) reusableView = [self rq_viewFromXib];
- return reusableView;
- }
- - (void)bindViewModel:(NYBlockExerciseGroupViewModel *)viewModel {
- self.viewModel = viewModel;
- self.name_label.text = viewModel.header;
- self.des_label.text = viewModel.headerDesStr;
- if(viewModel.star>0){
- for(int i=0;i<viewModel.star;i++){
- UIButton *btn = [self.stars_view viewWithTag:10+i];
- btn.selected = YES;
- }
- }
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- @end
|