RQProfileUserAndVipCell.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. //
  2. // RQProfileUserAndVipCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/4/26.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQProfileUserAndVipCell.h"
  9. @interface RQProfileUserAndVipCell () <UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
  10. @property (nonatomic, readwrite, strong) RQProfileUserAndVipItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIView *vipContentView;
  12. @property (weak, nonatomic) IBOutlet UIImageView *myBgImageView;
  13. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *btnsViewToTop;
  14. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *headImagViewToTop;
  15. @property (weak, nonatomic) IBOutlet QMUIButton *settingBtn;
  16. @property (weak, nonatomic) IBOutlet QMUIButton *messageBtn;
  17. @property (weak, nonatomic) IBOutlet UIImageView *myHeadImageView;
  18. @property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
  19. @property (weak, nonatomic) IBOutlet QMUIButton *telePhoneBtn;
  20. @property (weak, nonatomic) IBOutlet QMUIButton *carTypeBtn;
  21. @property (weak, nonatomic) IBOutlet UIImageView *detailArrowImg;
  22. @property (weak, nonatomic) IBOutlet QMUIButton *schoolNameBtn;
  23. @property (nonatomic, readwrite, assign) CGFloat btnsViewHeight;
  24. @property (nonatomic, readwrite, assign) CGFloat headImageViewHeight;
  25. @property (nonatomic, readwrite, assign) CGFloat headImageViewCornerRadiusHeight;
  26. @property (nonatomic, readwrite, assign) BOOL isScrolling;
  27. @property (nonatomic, readwrite, strong) UICollectionView *vipCollectionView;
  28. @property (nonatomic, readwrite, strong) QMUICollectionViewPagingLayout *vipCollectionViewFlowLayout;
  29. @end
  30. @implementation RQProfileUserAndVipCell
  31. #pragma mark - PublicMethods
  32. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  33. static NSString *ID = @"RQProfileUserAndVipCell";
  34. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  35. RQProfileUserAndVipCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  36. if (!cell) cell = [self rq_viewFromXib];
  37. [cell.vipContentView addSubview:cell.vipCollectionView];
  38. CAShapeLayer *maskLayer = [CAShapeLayer layer];
  39. maskLayer.fillColor = [UIColor redColor].CGColor;
  40. maskLayer.lineWidth = 1;
  41. // CGFloat cellHeight = RQ_COMMON_MANAGER.APP_SWITCH? RQ_FIT_HORIZONTAL(158.f) : RQ_FIT_HORIZONTAL(328.f);
  42. CGFloat cellHeight = RQ_FIT_HORIZONTAL(328.f);
  43. CGFloat a = RQ_FIT_HORIZONTAL(22.f);
  44. CGFloat radius = (((RQ_SCREEN_WIDTH / 2.f) * (RQ_SCREEN_WIDTH / 2.f)) - (a * a)) / (2 * a);
  45. UIBezierPath* aPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(RQ_SCREEN_WIDTH / 2.f, cellHeight - radius) radius:radius startAngle:0 endAngle:M_PI * 2 clockwise:YES];
  46. maskLayer.path = aPath.CGPath;
  47. cell.vipContentView.layer.mask = maskLayer;
  48. return cell;
  49. }
  50. - (void)bindViewModel:(RQProfileUserAndVipItemViewModel *)viewModel {
  51. self.viewModel = viewModel;
  52. @weakify(self);
  53. [[RACObserve(viewModel, userModel.photo) takeUntil:self.rac_prepareForReuseSignal] subscribeNext:^(NSString *imageName) {
  54. @strongify(self);
  55. [self.myHeadImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.userModel.photo] placeholder:RQWebAvatarImagePlaceholder() options:RQWebImageOptionAutomatic completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
  56. if(image) {
  57. image = [image qmui_imageResizedInLimitedSize:CGSizeMake(RQ_FIT_HORIZONTAL(70.f), RQ_FIT_HORIZONTAL(70.f)) resizingMode:QMUIImageResizingModeScaleAspectFill];
  58. image = [image qmui_imageWithBorderColor:UIColor.whiteColor borderWidth:1 cornerRadius:RQ_FIT_HORIZONTAL(70.f) / 2.f];
  59. self.myHeadImageView.image = image;
  60. }
  61. }];
  62. }];
  63. RAC(_userNameLabel, text) = [RACObserve(viewModel, userModel.nickName) takeUntil:self.rac_prepareForReuseSignal];
  64. RAC(_telePhoneBtn, rq_titleStr) = [RACObserve(viewModel, userModel.telphone) takeUntil:self.rac_prepareForReuseSignal];
  65. RAC(_carTypeBtn, rq_titleStr) = [RACObserve(viewModel, userModel.carType) takeUntil:self.rac_prepareForReuseSignal];
  66. RAC(_schoolNameBtn, rq_titleStr) = [[RACObserve(viewModel, userModel.schoolName) map:^id _Nullable(id _Nullable value) {
  67. if (RQObjectIsNil(viewModel.userModel.schInfo)) {
  68. return RQStringIsNotEmpty(viewModel.userModel.schoolName)? viewModel.userModel.schoolName : @"未获取到驾校名称";
  69. } else {
  70. return RQStringIsNotEmpty(viewModel.userModel.schInfo.name)? viewModel.userModel.schInfo.name : (RQStringIsNotEmpty(viewModel.userModel.schoolName)? viewModel.userModel.schoolName : @"未获取到驾校名称");
  71. }
  72. }] takeUntil:self.rac_prepareForReuseSignal];
  73. }
  74. #pragma mark - SystemMethods
  75. - (void)awakeFromNib {
  76. [super awakeFromNib];
  77. [self btnsViewHeight];
  78. [self headImageViewCornerRadiusHeight];
  79. _headImagViewToTop.constant = RQ_APPLICATION_STATUS_BAR_HEIGHT + 16.f + (RQ_FIT_HORIZONTAL(20.f) * (17.f / 15.f)) + 16.f;
  80. _btnsViewToTop.constant = RQ_APPLICATION_STATUS_BAR_HEIGHT + 16.f;
  81. [_messageBtn setQmui_badgeInteger:14];
  82. self.myHeadImageView.layer.cornerRadius = self.headImageViewCornerRadiusHeight;
  83. CGFloat myWidth = RQ_SCREEN_WIDTH - 16 - 16 + 10;
  84. RACSignal *signal = [[RACSignal combineLatest:@[RACObserve(self.vipCollectionView, contentOffset), RACObserve(self, isScrolling)] reduce:^id (id _Nullable x, id _Nullable y) {
  85. if (!_isScrolling) {
  86. NSLog(@"%.f-----%f",self.vipCollectionView.contentOffset.x, round(self.vipCollectionView.contentOffset.x / myWidth));
  87. NSInteger a = round(self.vipCollectionView.contentOffset.x / myWidth);
  88. RQ_Profile_Module.profileSubject = a;
  89. switch (a) {
  90. case 0:
  91. self.myBgImageView.image = RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"科一科四 已开通") : RQImageNamed(@"科一科四");
  92. self.userNameLabel.textColor = RQ_VIP_Module.isSubject1Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  93. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubject1Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  94. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  95. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubject1Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  96. [self.carTypeBtn setImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  97. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubject1Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  98. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  99. [self.detailArrowImg setImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  100. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  101. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  102. break;
  103. case 1:
  104. self.myBgImageView.image = RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"科二 已开通") : RQImageNamed(@"科二");
  105. self.userNameLabel.textColor = RQ_VIP_Module.isSubject2Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  106. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubject2Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  107. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  108. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubject2Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  109. [self.carTypeBtn setImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  110. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubject2Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  111. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  112. [self.detailArrowImg setImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  113. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  114. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  115. break;
  116. case 2:
  117. self.myBgImageView.image = RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"科三 已开通") : RQImageNamed(@"科三");
  118. self.userNameLabel.textColor = RQ_VIP_Module.isSubject3Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  119. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubject3Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  120. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  121. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubject3Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  122. [self.carTypeBtn setImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  123. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubject3Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  124. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  125. [self.detailArrowImg setImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  126. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  127. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  128. break;
  129. case 3:
  130. self.myBgImageView.image = RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"科一科四 已开通") : RQImageNamed(@"科一科四");
  131. self.userNameLabel.textColor = RQ_VIP_Module.isSubject4Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  132. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubject4Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  133. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  134. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubject4Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  135. [self.carTypeBtn setImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  136. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubject4Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  137. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  138. [self.detailArrowImg setImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  139. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  140. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  141. break;
  142. case 4:
  143. self.myBgImageView.image = RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"科四 已开通") : RQImageNamed(@"科四");
  144. self.userNameLabel.textColor = RQ_VIP_Module.isSubjectAllVip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  145. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubjectAllVip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  146. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  147. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubjectAllVip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  148. [self.carTypeBtn setImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  149. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubjectAllVip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  150. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  151. [self.detailArrowImg setImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  152. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  153. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  154. break;
  155. default:
  156. break;
  157. }
  158. }
  159. return @"";
  160. }] takeUntil:self.rac_prepareForReuseSignal];
  161. [signal subscribeNext:^(NSArray *allArr) {
  162. }];
  163. }
  164. - (void)layoutSubviews {
  165. [super layoutSubviews];
  166. @weakify(self)
  167. [self.vipCollectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
  168. @strongify(self)
  169. make.top.mas_equalTo(self.myHeadImageView.mas_bottom).mas_offset(20);
  170. make.left.right.mas_equalTo(self.vipContentView);
  171. make.bottom.mas_equalTo(self.vipContentView.mas_bottom).mas_offset(12);
  172. // make.height.mas_equalTo(RQ_FIT_HORIZONTAL(169.f));
  173. }];
  174. }
  175. #pragma mark - PrivateMethods
  176. - (IBAction)settingAction:(id)sender {
  177. [RQ_APPDELEGATE.services pushViewModel:[[RQSettingViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil] animated:YES];
  178. }
  179. #pragma mark - UICollectionViewDatasource
  180. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  181. return 1;
  182. }
  183. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  184. return 5;
  185. }
  186. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  187. switch (indexPath.row) {
  188. case 0: {
  189. RQProfileSubjectOneVipCell *cell = [RQProfileSubjectOneVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  190. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  191. itemViewModel.profileSubject = indexPath.row;
  192. [cell bindViewModel:itemViewModel];
  193. return cell;
  194. }
  195. case 1: {
  196. RQProfileSubjectTwoVipCell *cell = [RQProfileSubjectTwoVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  197. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  198. itemViewModel.profileSubject = indexPath.row;
  199. [cell bindViewModel:itemViewModel];
  200. return cell;
  201. }
  202. case 2: {
  203. RQProfileSubjectThreeVipCell *cell = [RQProfileSubjectThreeVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  204. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  205. itemViewModel.profileSubject = indexPath.row;
  206. [cell bindViewModel:itemViewModel];
  207. return cell;
  208. }
  209. case 3: {
  210. RQProfileSubjectFourVipCell *cell = [RQProfileSubjectFourVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  211. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  212. itemViewModel.profileSubject = indexPath.row;
  213. [cell bindViewModel:itemViewModel];
  214. return cell;
  215. }
  216. default: {
  217. RQProfileVipCell *cell = [RQProfileVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  218. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  219. itemViewModel.profileSubject = indexPath.row;
  220. [cell bindViewModel:itemViewModel];
  221. return cell;
  222. }
  223. }
  224. }
  225. #pragma mark - UICollectionViewDelegate
  226. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  227. [collectionView deselectItemAtIndexPath:indexPath animated:YES];
  228. }
  229. #pragma mark - UICollectionViewDelegateFlowLayout
  230. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
  231. CGSize size = CGSizeMake(CGRectGetWidth(self.vipCollectionView.bounds) - UIEdgeInsetsGetHorizontalValue(self.vipCollectionViewFlowLayout.sectionInset), CGRectGetHeight(self.vipCollectionView.bounds) - UIEdgeInsetsGetVerticalValue(self.vipCollectionViewFlowLayout.sectionInset));
  232. return size;
  233. }
  234. - (void)scrollViewDidScroll:(UIScrollView *)sender {
  235. self.isScrolling = YES;
  236. [NSObject cancelPreviousPerformRequestsWithTarget:self];
  237. [self performSelector:@selector(scrollViewDidEndScrollingAnimation:) withObject:sender afterDelay:0.1];
  238. }
  239. - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
  240. self.isScrolling = NO;
  241. [NSObject cancelPreviousPerformRequestsWithTarget:self];
  242. }
  243. #pragma mark - LazyLoad
  244. - (CGFloat)btnsViewHeight {
  245. if (_btnsViewHeight == 0) _btnsViewHeight = (RQ_FIT_HORIZONTAL(60.f) - 16.f) / 2.f;
  246. return _btnsViewHeight;
  247. }
  248. - (CGFloat)headImageViewHeight {
  249. if (_headImageViewHeight == 0) _headImageViewHeight = (RQ_FIT_HORIZONTAL(70.f));
  250. return _headImageViewHeight;
  251. }
  252. - (CGFloat)headImageViewCornerRadiusHeight {
  253. if (_headImageViewCornerRadiusHeight == 0) _headImageViewCornerRadiusHeight = self.headImageViewHeight / 2.f;
  254. return _headImageViewCornerRadiusHeight;
  255. }
  256. - (UICollectionView *)vipCollectionView {
  257. if (!_vipCollectionView) {
  258. _vipCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_myHeadImageView.frame) + 20, RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(169.f)) collectionViewLayout:self.vipCollectionViewFlowLayout];
  259. _vipCollectionView.delegate = self;
  260. _vipCollectionView.dataSource = self;
  261. _vipCollectionView.showsHorizontalScrollIndicator = NO;
  262. _vipCollectionView.backgroundColor = UIColorClear;
  263. [_vipCollectionView registerNib:[UINib nibWithNibName:@"RQProfileVipCell" bundle:nil] forCellWithReuseIdentifier:@"RQProfileVipCell"];
  264. }
  265. return _vipCollectionView;
  266. }
  267. - (QMUICollectionViewPagingLayout *)vipCollectionViewFlowLayout {
  268. if (!_vipCollectionViewFlowLayout) {
  269. _vipCollectionViewFlowLayout = [[QMUICollectionViewPagingLayout alloc] initWithStyle:QMUICollectionViewPagingLayoutStyleDefault];
  270. _vipCollectionViewFlowLayout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
  271. _vipCollectionViewFlowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
  272. _vipCollectionViewFlowLayout.allowsMultipleItemScroll = NO;
  273. }
  274. return _vipCollectionViewFlowLayout;
  275. }
  276. @end