123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625 |
- //
- // YMPersonalPageInfoView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/17.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMPersonalPageInfoView.h"
- #import "YMPersonalPageViewModel.h"
- #import "YMPersonalPageInfoCell.h"
- #import "CHTCollectionViewWaterfallLayout.h"
- @interface YMPersonalPageInfoView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout,CHTCollectionViewDelegateWaterfallLayout>
- /// 个人主页VM
- @property (nonatomic, strong) YMPersonalPageViewModel *viewModel;
- /// 用户昵称标签
- @property (nonatomic, strong) UILabel *userNicknameLb;
- /// 用户在线状态视图
- @property (nonatomic, strong) UIView *userOnlineStatusView;
- /// 用户在线状态点
- @property (nonatomic, strong) UIView *userOnlineStatusPoint;
- /// 用户在线状态标签
- @property (nonatomic, strong) UILabel *userOnlineStatusLb;
- /// 状态堆叠视图
- @property (nonatomic, strong) UIStackView *statusStackView;
- /// 用户性别和年龄视图
- @property (nonatomic, strong) UIView *userGenderAndAgeView;
- /// 用户性别图标
- @property (nonatomic, strong) UIImageView *userGenderAndAgeIcon;
- /// 用户年龄标签
- @property (nonatomic, strong) UILabel *userGenderAndAgeLb;
- /// 用户真人认证图标
- @property (nonatomic, strong) UIImageView *userRealPersonCertIcon;
- /// 用户VIP图标
- @property (nonatomic, strong) UIImageView *userVIPIcon;
- /// 关注按钮
- @property (nonatomic, strong) UIButton *followBtn;
- /// 用户视频费用金额按钮
- @property (nonatomic, strong) UIButton *userVideoFeesAmountBtn;
- /// 用户简介视图背景
- @property (nonatomic, strong) UIView *userIntroBgv;
- /// 用户简介视图
- @property (nonatomic, strong) UIImageView *userIntroView;
- /// 用户简介标签
- @property (nonatomic, strong) UILabel *userIntroLb;
- /// 用户简介图标
- @property (nonatomic, strong) UIImageView *userIntroIcon;
- /// 个人主页信息标签
- @property (nonatomic, strong) UILabel *personalPageInfoLb;
- /// 信息排版
- @property (nonatomic, strong) CHTCollectionViewWaterfallLayout *infoLayout;
- /// 信息容器列表
- @property (nonatomic, strong) UICollectionView *infoCollectionView;
- @end
- @implementation YMPersonalPageInfoView
- - (void)ym_setupViews{
-
- // [self addSubview:self.userNicknameLb];
- //
- // [self addSubview:self.userOnlineStatusView];
- // [self.userOnlineStatusView addSubview:self.userOnlineStatusPoint];
- // [self.userOnlineStatusView addSubview:self.userOnlineStatusLb];
- //
- // [self addSubview:self.statusStackView];
- //
- // [self.statusStackView addArrangedSubview:self.userGenderAndAgeView];
- // [self.userGenderAndAgeView addSubview:self.userGenderAndAgeIcon];
- // [self.userGenderAndAgeView addSubview:self.userGenderAndAgeLb];
- //
- // [self.statusStackView addArrangedSubview:self.userRealPersonCertIcon];
- // [self.statusStackView addArrangedSubview:self.userVIPIcon];
- //
- // [self addSubview:self.userVideoFeesAmountBtn];
- // [self addSubview:self.followBtn];
-
- [self addSubview:self.userIntroBgv];
- [self addSubview:self.userIntroView];
- [self.userIntroBgv addSubview:self.userIntroLb];
- // [self addSubview:self.userIntroIcon];
-
- [self addSubview:self.personalPageInfoLb];
- [self addSubview:self.infoCollectionView];
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
- }
- - (void)updateConstraints{
-
- // [self.userNicknameLb mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self).offset(adapt(20));
- // make.left.equalTo(self).offset(adapt(20));
- // }];
-
- // [self.userOnlineStatusView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerY.equalTo(self.userNicknameLb.mas_centerY);
- // make.left.equalTo(self.userNicknameLb.mas_right).offset(adapt(10));
- // make.height.mas_equalTo(adapt(18));
- // }];
- //
- // [self.userOnlineStatusPoint mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerY.equalTo(self.userOnlineStatusView.mas_centerY);
- // make.left.equalTo(self.userOnlineStatusView).offset(adapt(10));
- // make.width.height.mas_equalTo(adapt(6));
- // }];
- //
- // [self.userOnlineStatusLb mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerY.equalTo(self.userOnlineStatusView.mas_centerY);
- // make.left.equalTo(self.userOnlineStatusPoint.mas_right).offset(adapt(5));
- // make.right.equalTo(self.userOnlineStatusView).offset(adapt(-10));
- // }];
- //
- // [self.statusStackView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.userNicknameLb.mas_bottom).offset(adapt(10));
- // make.left.equalTo(self).offset(adapt(20));
- // }];
-
- // [self.userGenderAndAgeView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.height.mas_equalTo(adapt(15));
- // }];
-
- // [self.userGenderAndAgeIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.userGenderAndAgeView);
- // make.left.equalTo(self.userGenderAndAgeView).offset(adapt(7));
- // make.bottom.equalTo(self.userGenderAndAgeView);
- // make.width.height.mas_equalTo(adapt(15));
- // }];
- //
- // [self.userGenderAndAgeLb mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerY.equalTo(self.userGenderAndAgeView.mas_centerY);
- // make.left.equalTo(self.userGenderAndAgeIcon.mas_right).offset(adapt(3));
- // make.right.equalTo(self.userGenderAndAgeView).offset(adapt(-7));
- // }];
- //
- // [self.userRealPersonCertIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.width.mas_equalTo(adapt(66));
- // make.height.mas_equalTo(adapt(15));
- // }];
- //
- // [self.userVIPIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.width.mas_equalTo(adapt(40));
- // make.height.mas_equalTo(adapt(15));
- // }];
- //
- // [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerY.equalTo(self.userNicknameLb.mas_centerY);
- // make.right.equalTo(self).offset(adapt(-20));
- // make.width.mas_equalTo(adapt(80));
- // make.height.mas_equalTo(adapt(30));
- // }];
- //
- // [self.userVideoFeesAmountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
- // make.left.equalTo(self).offset(adapt(20));
- // }];
-
- [self.userIntroBgv mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(adapt(5));
- make.centerX.equalTo(self);
- make.width.mas_equalTo(adapt(332));
- make.height.mas_equalTo(adapt(50));
- }];
-
- [self.userIntroView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(self.userIntroBgv.mas_top).offset(adapt(6));
- make.left.equalTo(self.userIntroBgv.mas_left).offset(adapt(0));
- make.height.mas_equalTo(adapt(14));
- }];
-
- [self.userIntroLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.userIntroBgv).offset(adapt(15));
- make.left.equalTo(self.userIntroBgv).offset(adapt(20));
- make.right.equalTo(self.userIntroBgv).offset(adapt(-15));
- make.bottom.equalTo(self.userIntroBgv).offset(adapt(-15));
- }];
-
- // [self.userIntroIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.userIntroView.mas_top).offset(adapt(-7));
- // make.right.equalTo(self.userIntroView).offset(adapt(-5));
- // make.width.height.mas_equalTo(adapt(20));
- // }];
-
- [self.personalPageInfoLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(adapt(5));
- make.left.equalTo(self).offset(adapt(20));
- }];
-
- [self.infoCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.personalPageInfoLb.mas_bottom).offset(adapt(10));
- make.left.equalTo(self).offset(adapt(20));
- make.right.equalTo(self).offset(adapt(-20));
- make.bottom.equalTo(self).offset(adapt(-10));
- }];
-
- [super updateConstraints];
- }
- - (void)ym_bindViewModel:(YMPersonalPageViewModel *)viewModel{
- if (!viewModel) {
- return;
- }
-
- _viewModel = viewModel;
-
- @weakify(self)
- [[self.viewModel.refreshUISubject takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id result) {
- @strongify(self)
- [self.infoCollectionView reloadData];
- [self.infoCollectionView layoutIfNeeded];
- //刷新高度
- CGFloat infoCollectionViewHeight = self.infoCollectionView.collectionViewLayout.collectionViewContentSize.height;
- [self.infoCollectionView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(infoCollectionViewHeight);
- }];
- }];
-
- // RAC(self.userNicknameLb, text) = RACObserve(self.viewModel, userNickname);
- // RAC(self.userNicknameLb, textColor) = RACObserve(self.viewModel, userNicknameColor);
- //
- // [[[[RACObserve(self.viewModel, userOnlineStatusColor) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(UIColor * userOnlineStatusColor) {
- // @strongify(self)
- // self.userOnlineStatusView.layer.borderColor = userOnlineStatusColor.CGColor;
- // self.userOnlineStatusPoint.backgroundColor = userOnlineStatusColor;
- // self.userOnlineStatusLb.textColor = userOnlineStatusColor;
- // }];
- //
- // [[[[RACObserve(self.viewModel, userOnlineStatusText) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * userOnlineStatusText) {
- // @strongify(self)
- // self.userOnlineStatusLb.text = userOnlineStatusText;
- // }];
- //
- // RAC(self.userGenderAndAgeIcon, image) = RACObserve(self.viewModel, userGenderAndAgeIcon);
- //
- // RAC(self.userGenderAndAgeLb, text) = RACObserve(self.viewModel, userGenderAndAgeText);
- //
- // [[[[RACObserve(self.viewModel, userGender) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * userGender) {
- // @strongify(self)
- // if ([userGender isEqualToString:@"女"]) {
- // [self.userGenderAndAgeView ym_setGradientBackgroundWithColors:kMainGradColors locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- // } else {
- // [self.userGenderAndAgeView ym_setGradientBackgroundWithColors:kMainGradColors locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- //
- // }
- // }];
- //
- // [[[[RACObserve(self.viewModel, isRealPersonCert) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isRealPersonCert) {
- // @strongify(self)
- // if ([isRealPersonCert boolValue]) {
- // self.userRealPersonCertIcon.hidden = NO;
- // } else {
- // self.userRealPersonCertIcon.hidden = YES;
- // }
- // }];
-
- // [[[[RACObserve(self.viewModel, isVIP) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isVIP) {
- // @strongify(self)
- // if ([isVIP boolValue]) {
- // self.userVIPIcon.hidden = NO;
- // } else {
- // self.userVIPIcon.hidden = YES;
- // }
- // }];
-
- // [[[[RACObserve(self.viewModel, userVideoFeesAmount) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * userVideoFeesAmount) {
- // @strongify(self)
- // [self.userVideoFeesAmountBtn setTitle:userVideoFeesAmount?:@"****钻石/分钟" forState:UIControlStateNormal];
- // }];
-
- // [[[[RACObserve(self.viewModel, isHideUserFeesAmount) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isHideUserFeesAmount) {
- // @strongify(self)
- // if ([isHideUserFeesAmount boolValue]) {
- // self.userVideoFeesAmountBtn.hidden = YES;
- // [self.userVideoFeesAmountBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
- //
- // }];
- //
- // [self.userIntroView mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(20));
- // make.left.equalTo(self).offset(adapt(20));
- // make.right.equalTo(self).offset(adapt(-20));
- // }];
- // } else {
- // self.userVideoFeesAmountBtn.hidden = NO;
- // [self.userVideoFeesAmountBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
- // make.left.equalTo(self).offset(adapt(20));
- // }];
- //
- // [self.userIntroView mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.userVideoFeesAmountBtn.mas_bottom).offset(adapt(20));
- // make.left.equalTo(self).offset(adapt(20));
- // make.right.equalTo(self).offset(adapt(-20));
- // }];
- // }
- // }];
-
- RAC(self.userIntroLb, text) = RACObserve(self.viewModel, userIntro);
-
- [[[[RACObserve(self.viewModel, isFollow) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isFollow) {
- @strongify(self)
- if (![isFollow boolValue]) {
- [self.followBtn setTitle:@"关注" forState:UIControlStateNormal];
- [self.followBtn ym_setGradientBackgroundWithColors:kMainGradColors locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- }else{
- [self.followBtn setTitle:@"已关注" forState:UIControlStateNormal];
- [self.followBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGB(0xCCCCCC),HexColorFromRGB(0xCCCCCC)] locations:kMainGradLocation startPoint:CGPointMake(1, 1) endPoint:CGPointMake(1, 1)];
- }
- }];
-
- [[[[RACObserve(self.viewModel, isOtherPersonalPage) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber *isOtherPersonalPage) {
- @strongify(self)
- if ([isOtherPersonalPage boolValue]) {
- self.followBtn.hidden = NO;
- } else {
- self.followBtn.hidden = YES;
-
- }
- }];
-
- }
- #pragma mark - UICollectionViewDataSource
- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
- return 1;
- }
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
- return self.viewModel.infoDataArray.count;
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
- YMPersonalPageInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YMPersonalPageInfoCell class]) forIndexPath:indexPath];
- [cell ym_bindViewModel:self.viewModel.infoDataArray[indexPath.item]];
- return cell;
- }
- - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
- UICollectionReusableView *reusableView = nil;
- reusableView.backgroundColor = [UIColor clearColor];
- return reusableView;
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
- return CGSizeZero;
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section{
- return CGSizeZero;
- }
- #pragma mark - UICollectionViewDelegate
- - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
- if (!self.viewModel.infoDataArray[indexPath.item].isHideCopy) {
- UIPasteboard *pab = [UIPasteboard generalPasteboard];
- pab.string = self.viewModel.infoDataArray[indexPath.item].infoContent?:@"";
- if (pab == nil) {
- [ZCHUDHelper showTitle:@"复制失败"];
- }else{
- [ZCHUDHelper showTitle:@"已复制到剪切板"];
- }
- }
- }
- #pragma mark - CHTCollectionViewDelegateWaterfallLayout
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
- return CGSizeMake(adapt(220), adapt(30));
- // CGFloat realW = UIScreen.mainScreen.bounds.size.width - adapt(20 * 2) - adapt(10 * 2);
- // CGFloat width = (realW / 3) - 1;
- // return CGSizeMake(width, adapt(30));
- }
- - (UILabel *)userNicknameLb{
- if (!_userNicknameLb) {
- _userNicknameLb = [[UILabel alloc]init];
- _userNicknameLb.font = LCBoldFont(20);
- _userNicknameLb.textColor = HexColorFromRGB(0x000000);
- _userNicknameLb.textAlignment = NSTextAlignmentLeft;
- _userNicknameLb.text = @"******";
- }
- return _userNicknameLb;
- }
- - (UIView *)userOnlineStatusView{
- if (!_userOnlineStatusView) {
- _userOnlineStatusView = [[UIView alloc]init];
- _userOnlineStatusView.layer.borderWidth = 1;
- _userOnlineStatusView.layer.borderColor = HexColorFromRGB(0xD8BFD8).CGColor;
- _userOnlineStatusView.layer.cornerRadius = adapt(18)/2;
- _userOnlineStatusView.layer.masksToBounds = YES;
- }
- return _userOnlineStatusView;
- }
- - (UIView *)userOnlineStatusPoint{
- if (!_userOnlineStatusPoint) {
- _userOnlineStatusPoint = [[UIView alloc]init];
- _userOnlineStatusPoint.backgroundColor = HexColorFromRGB(0xD8BFD8);
- _userOnlineStatusPoint.layer.cornerRadius = adapt(6)/2;
- _userOnlineStatusPoint.layer.masksToBounds = YES;
- }
- return _userOnlineStatusPoint;
- }
- - (UILabel *)userOnlineStatusLb{
- if (!_userOnlineStatusLb) {
- _userOnlineStatusLb = [[UILabel alloc]init];
- _userOnlineStatusLb.font = LCFont(10);
- _userOnlineStatusLb.textColor = HexColorFromRGB(0xD8BFD8);
- _userOnlineStatusLb.textAlignment = NSTextAlignmentCenter;
- _userOnlineStatusLb.text = @"离线";
- }
- return _userOnlineStatusLb;
- }
- - (UIStackView *)statusStackView{
- if (!_statusStackView) {
- _statusStackView = [[UIStackView alloc]init];
- /**
- UILayoutConstraintAxisVertical 纵向
- UILayoutConstraintAxisHorizontal 横向
- */
- _statusStackView.axis = UILayoutConstraintAxisHorizontal;
- /**
- UIsectionStackViewAlignmentFill 将sectionStackView充满
- 比如label,不管文字多少,将大小按照设置的非主轴方向充满
- ex: Vertical 就是水平铺满
-
- UIsectionStackViewAlignmentLeading 在Vertical方向上生效,表示左对齐
- 比如label,文字自适应,如果小于非主轴方向的宽度,将不充满
-
- UIsectionStackViewAlignmentTop 在Horizontal方向上生效,表示左对齐
- 比如label,文字自适应,如果小于非主轴方向的高度,将不充满
- 本质UIsectionStackViewAlignmentTop = UIsectionStackViewAlignmentLeading
-
- UIsectionStackViewAlignmentTrailing 在Vertical方向上生效,表示右对齐
- 比如label,文字自适应,如果小于非主轴方向的宽度,将不充满
-
- UIsectionStackViewAlignmentBottom 在Horizontal方向上生效,表示右对齐
- 比如label,文字自适应,如果小于非主轴方向的高度,将不充满
- 本质UIsectionStackViewAlignmentBottom = UIsectionStackViewAlignmentTrailing
-
- UIsectionStackViewAlignmentLastBaseline 仅限于Horizontal
- 按照最高的一个视图的bottom对齐,最高的视图top对齐
-
- UIsectionStackViewAlignmentCenter 中心对齐
- 不充满,沿主轴方向中心对齐
- */
- _statusStackView.alignment = UIStackViewAlignmentCenter;
- _statusStackView.spacing = adapt(10);
-
- }
- return _statusStackView;
- }
- - (UIView *)userGenderAndAgeView{
- if (!_userGenderAndAgeView) {
- _userGenderAndAgeView = [[UIView alloc]init];
- _userGenderAndAgeView.layer.cornerRadius = adapt(15)/2;
- }
- return _userGenderAndAgeView;
- }
- - (UIImageView *)userGenderAndAgeIcon{
- if (!_userGenderAndAgeIcon) {
- _userGenderAndAgeIcon = [[UIImageView alloc]init];
- _userGenderAndAgeIcon.image = ImageByName(@"ym_personal_page_female_icon");
- }
- return _userGenderAndAgeIcon;
- }
- - (UILabel *)userGenderAndAgeLb{
- if (!_userGenderAndAgeLb) {
- _userGenderAndAgeLb = [[UILabel alloc]init];
- _userGenderAndAgeLb.font = LCFont(11);
- _userGenderAndAgeLb.textColor = HexColorFromRGB(0xFFFFFF);
- _userGenderAndAgeLb.textAlignment = NSTextAlignmentCenter;
- _userGenderAndAgeLb.text = @"***";
- }
- return _userGenderAndAgeLb;
- }
- - (UIImageView *)userRealPersonCertIcon{
- if (!_userRealPersonCertIcon) {
- _userRealPersonCertIcon = [[UIImageView alloc]init];
- _userRealPersonCertIcon.image = ImageByName(@"ym_personal_page_real_person_cert_icon");
- }
- return _userRealPersonCertIcon;
- }
- - (UIImageView *)userVIPIcon{
- if (!_userVIPIcon) {
- _userVIPIcon = [[UIImageView alloc]init];
- _userVIPIcon.image = ImageByName(@"ym_mine_vip_icon");
- }
- return _userVIPIcon;
- }
- - (UIButton *)followBtn{
- if (!_followBtn) {
- _followBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _followBtn.titleLabel.font = LCFont(14);
- [_followBtn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:UIControlStateNormal];
- [_followBtn setTitle:@"关注" forState:UIControlStateNormal];
- [_followBtn setImage:ImageByName(@"ym_personal_page_follow_icon") forState:UIControlStateNormal];
- [_followBtn ym_setGradientBackgroundWithColors:kMainGradColors locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- _followBtn.layer.cornerRadius = adapt(10);
- _followBtn.layer.masksToBounds = YES;
- _followBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
- [_followBtn setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
- CGFloat margin = 3;
- _followBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -margin, 0, margin);
- WS(weakSelf)
- [[[_followBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel followUser];
- }];
- }
- return _followBtn;
- }
- - (UIButton *)userVideoFeesAmountBtn{
- if (!_userVideoFeesAmountBtn) {
- _userVideoFeesAmountBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _userVideoFeesAmountBtn.titleLabel.font = LCBoldFont(11);
- [_userVideoFeesAmountBtn setTitleColor:HexColorFromRGB(0xB26AFD) forState:UIControlStateNormal];
- [_userVideoFeesAmountBtn setTitle:@"****钻石/分钟" forState:UIControlStateNormal];
- [_userVideoFeesAmountBtn setImage:ImageByName(@"ym_home_page_diamond_icon") forState:UIControlStateNormal];
- _userVideoFeesAmountBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- [_userVideoFeesAmountBtn setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
- CGFloat margin = 3;
- _userVideoFeesAmountBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -margin, 0, margin);
- }
- return _userVideoFeesAmountBtn;
- }
- - (UIView *)userIntroBgv {
- if (!_userIntroBgv) {
- _userIntroBgv = [[UIView alloc] init];
- _userIntroBgv.hidden = YES;
- _userIntroBgv.backgroundColor = HexColorFromRGB(0xF8F7F8);
- [_userIntroBgv addRectCorner:(UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight) radius:25];
- }
- return _userIntroBgv;
- }
- - (UIImageView *)userIntroView {
- if (!_userIntroView) {
- _userIntroView = [[UIImageView alloc] init];
- _userIntroView.hidden = YES;
- [_userIntroView setImage:[UIImage imageNamed:@"ym_personal_qm_bg"]];
- _userIntroView.contentMode = UIViewContentModeScaleAspectFit;
- // _userIntroView.backgroundColor = HexColorFromRGB(0xF6F6F6);
- // _userIntroView.layer.cornerRadius = adapt(10);
- // _userIntroView.layer.masksToBounds = YES;
- }
- return _userIntroView;
- }
- - (UILabel *)userIntroLb{
- if (!_userIntroLb) {
- _userIntroLb = [[UILabel alloc]init];
- _userIntroLb.hidden = YES;
- _userIntroLb.font = LCFont(15);
- _userIntroLb.textColor = HexColorFromRGBA(0x000000,0.55);
- _userIntroLb.textAlignment = NSTextAlignmentLeft;
- _userIntroLb.text = @"这个人很懒,什么都没有留下...";
- }
- return _userIntroLb;
- }
- - (UIImageView *)userIntroIcon{
- if (!_userIntroIcon) {
- _userIntroIcon = [[UIImageView alloc]init];
- _userIntroIcon.hidden = YES;
- _userIntroIcon.image = ImageByName(@"ym_personal_page_intro_icon");
- }
- return _userIntroIcon;
- }
- - (UILabel *)personalPageInfoLb{
- if (!_personalPageInfoLb) {
- _personalPageInfoLb = [[UILabel alloc]init];
- _personalPageInfoLb.font = LCBoldFont(17);
- _personalPageInfoLb.textColor = HexColorFromRGB(0x000000);
- _personalPageInfoLb.textAlignment = NSTextAlignmentLeft;
- _personalPageInfoLb.text = @"TA的信息";
- }
- return _personalPageInfoLb;
- }
- - (CHTCollectionViewWaterfallLayout *)infoLayout{
- if (!_infoLayout) {
- _infoLayout = [[CHTCollectionViewWaterfallLayout alloc] init];
- _infoLayout.columnCount = 2;
- _infoLayout.sectionInset = UIEdgeInsetsZero;
- }
- return _infoLayout;
- }
- - (UICollectionView *)infoCollectionView{
- if (!_infoCollectionView) {
- _infoCollectionView = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:self.infoLayout];
- _infoCollectionView.delegate = self;
- _infoCollectionView.dataSource = self;
- _infoCollectionView.showsVerticalScrollIndicator = NO;
- _infoCollectionView.showsHorizontalScrollIndicator = NO;
- _infoCollectionView.backgroundColor = UIColor.whiteColor;
- [_infoCollectionView registerClass:[YMPersonalPageInfoCell class] forCellWithReuseIdentifier:NSStringFromClass([YMPersonalPageInfoCell class])];
- }
- return _infoCollectionView;
- }
- @end
|