RQVipAlertHeaderCollectionReusableView.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // RQVipAlertHeaderCollectionReusableView.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/3/4.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQVipAlertHeaderCollectionReusableView.h"
  9. @interface RQVipAlertHeaderCollectionReusableView ()
  10. @property (weak, nonatomic) IBOutlet UIImageView *myBgImageView;
  11. @property (nonatomic, readwrite, strong) RQVipAlertHeaderGroupViewModel *viewModel;
  12. @end
  13. @implementation RQVipAlertHeaderCollectionReusableView
  14. + (instancetype)reusableViewWithCollectionView:(UICollectionView *)collectionView OfKind:(NSString *)elementKind forIndexPath:(NSIndexPath *)indexPath {
  15. NSString *ID = [NSString stringWithFormat:@"%@%@", @"RQVipAlertHeaderCollectionReusableView",elementKind];
  16. [collectionView registerNib:[UINib nibWithNibName:@"RQVipAlertHeaderCollectionReusableView" bundle:nil] forSupplementaryViewOfKind:elementKind withReuseIdentifier:ID];
  17. RQVipAlertHeaderCollectionReusableView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:ID forIndexPath:indexPath];
  18. if (!reusableView) reusableView = [self rq_viewFromXib];
  19. return reusableView;
  20. }
  21. - (void)bindViewModel:(RQVipAlertHeaderGroupViewModel *)viewModel {
  22. _viewModel = viewModel;
  23. }
  24. - (void)awakeFromNib {
  25. [super awakeFromNib];
  26. // Initialization code
  27. [_myBgImageView setImage:[UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
  28. graColor.fromColor = [UIColor qmui_colorWithHexString:@"#FFFFFF"];
  29. graColor.toColor = [UIColor qmui_colorWithHexString:@"#FEEEDF"];
  30. graColor.type = QQGradualChangeTypeLeftToRight;
  31. } size:CGSizeMake(RQ_SCREEN_WIDTH, 57) cornerRadius:QQRadiusZero]];
  32. }
  33. @end