123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476 |
- //
- // YMPersonalPageAboutView.m
- // MSYOUPAI
- //
- // Created by microtech macmini on 2024/7/6.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMPersonalPageViewModel.h"
- #import "YMPersonalPageAboutView.h"
- @interface YMPersonalPageAboutView ()
- /// 个人主页VM
- @property (nonatomic, strong) YMPersonalPageViewModel *viewModel;
- /// 用户昵称标签
- @property (nonatomic, strong) UILabel *userNicknameLb;
- /// 用户在线状态视图
- @property (nonatomic, strong) UIImageView *userOnlineStatusView;
- /// 用户在线状态点
- @property (nonatomic, strong) UIView *userOnlineStatusPoint;
- /// 用户在线状态标签
- @property (nonatomic, strong) UILabel *userOnlineStatusLb;
- /// 状态堆叠视图
- @property (nonatomic, strong) UIStackView *nameStackView;
- /// 状态堆叠视图
- @property (nonatomic, strong) UIStackView *statusStackView;
- /// 用户简介标签
- @property (nonatomic, strong) UILabel *userIntroLb;
- /// 用户性别和年龄视图
- @property (nonatomic, strong) UIView *userGenderAndAgeView;
- /// 用户性别图标
- @property (nonatomic, strong) UIImageView *userGenderAndAgeIcon;
- /// 用户年龄标签
- @property (nonatomic, strong) UILabel *userGenderAndAgeLb;
- /// 用户真人认证图标
- @property (nonatomic, strong) UIButton *userRealPersonCertIcon;
- /// 用户VIP图标
- @property (nonatomic, strong) UIImageView *userVIPIcon;
- /// 用户视频收费
- @property (nonatomic, strong) UIView *userFeesView;
- /// 用户性别图标
- @property (nonatomic, strong) UIImageView *diamondImgV;
- /// 用户年龄标签
- @property (nonatomic, strong) UILabel *feesLb;
- /// 关注按钮
- @property (nonatomic, strong) UIButton *followButn;
- /// 心动或搭讪按钮
- @property (nonatomic, strong) UIButton *heartbeatOrAccostBtn;
- @end
- @implementation YMPersonalPageAboutView
- - (void)ym_setupViews{
- [self addSubview:self.nameStackView];
- [self.nameStackView addArrangedSubview:self.userNicknameLb];
- [self.nameStackView addArrangedSubview:self.userOnlineStatusView];
-
- [self addSubview:self.userIntroLb];
-
- [self addSubview:self.statusStackView];
- [self.statusStackView addArrangedSubview:self.userGenderAndAgeView];
- [self.statusStackView addArrangedSubview:self.userRealPersonCertIcon];
- [self.userGenderAndAgeView addSubview:self.userGenderAndAgeIcon];
- [self.userGenderAndAgeView addSubview:self.userGenderAndAgeLb];
- [self.statusStackView addArrangedSubview:self.userFeesView];
- [self.userFeesView addSubview:self.diamondImgV];
- [self.userFeesView addSubview:self.feesLb];
- [self.statusStackView addArrangedSubview:self.userVIPIcon];
-
- // [self addSubview:self.followButn];
- // [self addSubview:self.heartbeatOrAccostBtn];
-
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
- }
- - (void)updateConstraints {
-
- [self.nameStackView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(adapt(20));
- make.left.equalTo(self).offset(adapt(12));
- make.height.mas_equalTo(adapt(20));
- }];
- [self.userNicknameLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(adapt(20));
- }];
- [self.userOnlineStatusView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(adapt(42));
- make.height.mas_equalTo(adapt(20));
- }];
-
- [self.statusStackView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.nameStackView.mas_bottom).offset(adapt(10));
- make.left.equalTo(self.mas_left).offset(adapt(12));
- make.height.mas_equalTo(adapt(22));
- }];
-
- [self.userIntroLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
- make.left.equalTo(self).offset(adapt(12));
- make.right.equalTo(self).offset(adapt(-12));
- make.bottom.equalTo(self.mas_bottom).offset(adapt(-10));
- }];
-
- [self.userRealPersonCertIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(adapt(62));
- make.height.mas_equalTo(adapt(22));
- }];
- [self.userGenderAndAgeView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(adapt(40));
- make.height.mas_equalTo(adapt(22));
- }];
- [self.userGenderAndAgeIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.userGenderAndAgeView.mas_centerY);
- make.left.equalTo(self.userGenderAndAgeView.mas_left).offset(adapt(4));
- make.height.mas_equalTo(adapt(9));
- }];
- [self.userGenderAndAgeLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.userGenderAndAgeView.mas_centerY);
- make.left.equalTo(self.userGenderAndAgeIcon.mas_right).offset(adapt(1));
- make.right.equalTo(self.userGenderAndAgeView.mas_right).offset(adapt(-6));
- }];
- [self.userFeesView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(adapt(22));
- }];
- [self.diamondImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.userFeesView.mas_left).offset(adapt(8));
- make.centerY.equalTo(self.userFeesView);
- make.height.mas_equalTo(adapt(10));
- }];
- [self.feesLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.userFeesView);
- make.left.equalTo(self.diamondImgV.mas_right).offset(adapt(3));
- make.right.equalTo(self.userFeesView).offset(adapt(-8));
- make.height.mas_equalTo(adapt(22));
- }];
- [self.userVIPIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(adapt(44));
- make.height.mas_equalTo(adapt(18));
- }];
-
- // [self.followButn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
- // make.left.equalTo(self.mas_left).offset(adapt(12));
- // make.width.mas_equalTo((kScreenWidth - (adapt(12) * 2) - 20) / 2);
- // make.height.mas_equalTo(adapt(40));
- // make.bottom.equalTo(self.mas_bottom).offset(adapt(-10));
- // }];
- //
- // [self.heartbeatOrAccostBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.followButn).offset(adapt(0));
- // make.right.equalTo(self.mas_right).offset(adapt(-12));
- // make.width.mas_equalTo((kScreenWidth - (adapt(12) * 2) - 20) / 2);
- // make.height.mas_equalTo(adapt(40));
- // }];
-
- [super updateConstraints];
- }
- - (void)ym_bindViewModel:(YMPersonalPageViewModel *)viewModel{
- if (!viewModel) { return; }
- _viewModel = viewModel;
- @weakify(self)
-
- RAC(self.userNicknameLb, text) = RACObserve(self.viewModel, userNickname);
- RAC(self.userNicknameLb, textColor) = RACObserve(self.viewModel, userNicknameColor);
-
- [[[[RACObserve(self.viewModel, userOnlineImgStr) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * userOnlineImgStr) {
- @strongify(self)
- self.userOnlineStatusView.image = ImageByName(userOnlineImgStr);
- }];
-
-
- 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.userGenderAndAgeLb.textColor = HexColorFromRGB(0xFF2682);
- self.userGenderAndAgeView.backgroundColor = HexColorFromRGB(0xFCF2FD);
- } else {
- self.userGenderAndAgeLb.textColor = HexColorFromRGB(0x037BFF);
- self.userGenderAndAgeView.backgroundColor = HexColorFromRGB(0xE1EFFF);
- NSString *textStr = [NSString stringWithFormat:@"余额: %@钻石",@(self.viewModel.balance)];
- self.feesLb.text = textStr;
- self.feesLb.textColor = HexColorFromRGB(0x883FFB);
- self.userFeesView.hidden = false;
- }
- }];
-
- [[[[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)
- NSString *textStr = userVideoFeesAmount?:@"***/分钟";
- self.feesLb.text = textStr;
- }];
-
- [[[[RACObserve(self.viewModel, isHideUserFeesAmount) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isHideUserFeesAmount) {
- @strongify(self)
- if ([isHideUserFeesAmount boolValue]) {
- self.userFeesView.hidden = YES;
- } else {
- self.userFeesView.hidden = NO;
- }
- }];
-
-
- 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.followButn setTitle:@" 关注" forState:UIControlStateNormal];
- // [self.followButn setImage:ImageByName(@"ym_personal_page_followable") forState:UIControlStateNormal];
- // [self.followButn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0x000000, 1),HexColorFromRGBA(0x000000, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- }else{
- // [self.followButn setTitle:@" 已关注" forState:UIControlStateNormal];
- // [self.followButn setImage:ImageByName(@"ym_personal_page_followed") forState:UIControlStateNormal];
- // [self.followButn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xF572EF, 1),HexColorFromRGBA(0x587BFC, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- }
- }];
-
- [[[[RACObserve(self.viewModel, isOtherPersonalPage) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber *isOtherPersonalPage) {
- @strongify(self)
- if ([isOtherPersonalPage boolValue]) {
- // self.followButn.hidden = NO;
- // [self.heartbeatOrAccostBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
- // make.right.equalTo(self.mas_right).offset(adapt(-12));
- // make.width.mas_equalTo((kScreenWidth - (adapt(12) * 2) - 20) / 2);
- // make.height.mas_equalTo(adapt(40));
- // }];
- } else {
- // self.followButn.hidden = YES;
- // [self.heartbeatOrAccostBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
- // make.left.equalTo(self.mas_left).offset(adapt(12));
- // make.right.equalTo(self.mas_right).offset(adapt(-12));
- // make.height.mas_equalTo(adapt(40));
- // }];
- }
- }];
-
- [[[[RACObserve(self.viewModel, heartbeatOrAccostButtonTitle) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString *heartbeatOrAccostButtonTitle) {
- @strongify(self)
- [self.heartbeatOrAccostBtn setTitle:heartbeatOrAccostButtonTitle forState:UIControlStateNormal];
- if([heartbeatOrAccostButtonTitle containsString:@"私聊"]){
- [self.heartbeatOrAccostBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xFB95FF, 1),HexColorFromRGBA(0xFF5F71, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- [self.heartbeatOrAccostBtn setTitleColor:MAINGRIDTitleC forState:UIControlStateNormal];
-
- }else{
- [self.heartbeatOrAccostBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xFB95FF, 1),HexColorFromRGBA(0xFF5F71, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- [self.heartbeatOrAccostBtn setTitleColor:MAINGRIDTitleC forState:UIControlStateNormal];
- }
- }];
-
- [[[[RACObserve(self.viewModel, heartbeatOrAccostButtonImage) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString *heartbeatOrAccostButtonImage) {
- @strongify(self)
- [self.heartbeatOrAccostBtn setImage:ImageByName(heartbeatOrAccostButtonImage) forState:UIControlStateNormal];
- }];
- }
- - (UILabel *)userNicknameLb{
- if (!_userNicknameLb) {
- _userNicknameLb = [[UILabel alloc]init];
- _userNicknameLb.font = LCBoldFont(18);
- _userNicknameLb.textColor = HexColorFromRGB(0xFFFFFF);
- _userNicknameLb.textAlignment = NSTextAlignmentLeft;
- _userNicknameLb.text = @"******";
- }
- return _userNicknameLb;
- }
- - (UIImageView *)userOnlineStatusView{
- if (!_userOnlineStatusView) {
- _userOnlineStatusView = [[UIImageView alloc] init];
- // _userOnlineStatusView.layer.borderWidth = 1;
- // _userOnlineStatusView.layer.borderColor = HexColorFromRGB(0xD8BFD8).CGColor;
- // _userOnlineStatusView.layer.cornerRadius = adapt(20)/2;
- // _userOnlineStatusView.layer.masksToBounds = YES;
- }
- return _userOnlineStatusView;
- }
- - (UIStackView *)nameStackView{
- if (!_nameStackView) {
- _nameStackView = [[UIStackView alloc]init];
- _nameStackView.axis = UILayoutConstraintAxisHorizontal;
- _nameStackView.alignment = UIStackViewAlignmentCenter;
- _nameStackView.spacing = adapt(6);
- }
- return _nameStackView;
- }
- - (UIStackView *)statusStackView{
- if (!_statusStackView) {
- _statusStackView = [[UIStackView alloc]init];
- _statusStackView.axis = UILayoutConstraintAxisHorizontal;
- _statusStackView.alignment = UIStackViewAlignmentCenter;
- _statusStackView.spacing = adapt(6);
- }
- return _statusStackView;
- }
- - (UILabel *)userIntroLb{
- if (!_userIntroLb) {
- _userIntroLb = [[UILabel alloc]init];
- _userIntroLb.font = LCFont(15);
- _userIntroLb.textColor = HexColorFromRGBA(0x000000,0.55);
- _userIntroLb.textAlignment = NSTextAlignmentLeft;
- _userIntroLb.text = @"这个人很懒,什么都没有留下...";
- }
- return _userIntroLb;
- }
- - (UIView *)userGenderAndAgeView{
- if (!_userGenderAndAgeView) {
- _userGenderAndAgeView = [[UIView alloc]init];
- _userGenderAndAgeView.layer.cornerRadius = adapt(10);
- _userGenderAndAgeView.backgroundColor = HexColorFromRGB(0xE9F8FB);
- _userGenderAndAgeView.layer.cornerRadius = adapt(22)/2;
- _userGenderAndAgeView.layer.masksToBounds = YES;
- }
- return _userGenderAndAgeView;
- }
- - (UIImageView *)userGenderAndAgeIcon{
- if (!_userGenderAndAgeIcon) {
- _userGenderAndAgeIcon = [[UIImageView alloc] init];
- _userGenderAndAgeIcon.image = ImageByName(@"ym_personal_page_female_icon");
- _userGenderAndAgeIcon.contentMode = UIViewContentModeScaleAspectFit;
- }
- return _userGenderAndAgeIcon;
- }
- - (UILabel *)userGenderAndAgeLb{
- if (!_userGenderAndAgeLb) {
- _userGenderAndAgeLb = [[UILabel alloc]init];
- _userGenderAndAgeLb.font = LCFont(11);
- _userGenderAndAgeLb.textColor = HexColorFromRGB(0xFF2682);
- _userGenderAndAgeLb.text = @"***";
- _userGenderAndAgeLb.textAlignment = NSTextAlignmentLeft;
- }
- return _userGenderAndAgeLb;
- }
- - (UIButton *)userRealPersonCertIcon{
- if (!_userRealPersonCertIcon) {
- _userRealPersonCertIcon = [UIButton buttonWithType:(UIButtonTypeCustom)];
- _userRealPersonCertIcon.userInteractionEnabled = NO;
- [_userRealPersonCertIcon setImage:ImageByName(@"ym_personal_page_real_person_cert_icon") forState:(UIControlStateNormal)];
- [_userRealPersonCertIcon setTitle:@" 已认证" forState:(UIControlStateNormal)];
- [_userRealPersonCertIcon setTitleColor:HexColorFromRGB(0x16CED0) forState:(UIControlStateNormal)];
- _userRealPersonCertIcon.titleLabel.font = LCFont(10);
- _userRealPersonCertIcon.backgroundColor = HexColorFromRGB(0xE9F8FB);
- _userRealPersonCertIcon.layer.cornerRadius = adapt(22)/2;
- _userRealPersonCertIcon.layer.masksToBounds = YES;
- }
- return _userRealPersonCertIcon;
- }
- - (UIImageView *)userVIPIcon{
- if (!_userVIPIcon) {
- _userVIPIcon = [[UIImageView alloc]init];
- _userVIPIcon.image = ImageByName(@"ym_mine_vip_icon");
- _userVIPIcon.contentMode = UIViewContentModeScaleAspectFit;
- }
- return _userVIPIcon;
- }
- - (UIView *)userFeesView{
- if (!_userFeesView) {
- _userFeesView = [[UIView alloc]init];
- _userFeesView.layer.cornerRadius = adapt(22) / 2;
- _userFeesView.layer.masksToBounds = YES;
- _userFeesView.backgroundColor = HexColorFromRGB(0xF3E1FF);
- }
- return _userFeesView;
- }
- - (UIImageView *)diamondImgV{
- if (!_diamondImgV) {
- _diamondImgV = [[UIImageView alloc]init];
- _diamondImgV.image = ImageByName(@"ym_personal_page_zs");
- _diamondImgV.contentMode = UIViewContentModeScaleAspectFit;
- }
- return _diamondImgV;
- }
- - (UILabel *)feesLb{
- if (!_feesLb) {
- _feesLb = [[UILabel alloc]init];
- _feesLb.font = LCBoldFont(9);
- _feesLb.textColor = HexColorFromRGB(0xFF3DD7);
- _feesLb.text = @"***";
- }
- return _feesLb;
- }
- - (UIButton *)followButn {
- if (!_followButn) {
- _followButn = [UIButton buttonWithType:(UIButtonTypeCustom)];
- _followButn.hidden = YES;
- [_followButn setTitle:@" 关注" forState:(UIControlStateNormal)];
- [_followButn setImage:ImageByName(@"ym_personal_page_followable") forState:UIControlStateNormal];
- [_followButn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:(UIControlStateNormal)];
- [_followButn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0x000000, 1),HexColorFromRGBA(0x000000, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- _followButn.titleLabel.font = LCFont(13);
- _followButn.backgroundColor = UIColor.clearColor;
- _followButn.layer.cornerRadius = adapt(20)/2;
- _followButn.layer.masksToBounds = YES;
- _followButn.layer.borderColor = HexColorFromRGB(0x8B45FB).CGColor;
- _followButn.layer.borderWidth = 0.5;
- WS(weakSelf)
- [[[_followButn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel followUser];
- }];
- }
- return _followButn;
- }
- - (UIButton *)heartbeatOrAccostBtn{
- if (!_heartbeatOrAccostBtn) {
- _heartbeatOrAccostBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _heartbeatOrAccostBtn.hidden = YES;
- [_heartbeatOrAccostBtn setTitle:@" 心动" forState:(UIControlStateNormal)];
- [_heartbeatOrAccostBtn setImage:ImageByName(@"ym_personal_page_msg") forState:UIControlStateNormal];
- [_heartbeatOrAccostBtn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:(UIControlStateNormal)];
- [_heartbeatOrAccostBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xFF6E79, 1),HexColorFromRGBA(0xFF6E79, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- _heartbeatOrAccostBtn.titleLabel.font = LCFont(16);
- _heartbeatOrAccostBtn.layer.cornerRadius = adapt(20)/2;
- _heartbeatOrAccostBtn.layer.masksToBounds = YES;
- _heartbeatOrAccostBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
- [_heartbeatOrAccostBtn setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
- CGFloat margin = 5;
- _heartbeatOrAccostBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -margin, 0, margin);
- WS(weakSelf)
- [[[_heartbeatOrAccostBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- if (weakSelf.viewModel.isOtherPersonalPage) {
- [weakSelf.viewModel sendAccostRequest];
- } else {
- [ZCHUDHelper showTitle:@"无法和自己互动"];
- }
- }];
- }
- return _heartbeatOrAccostBtn;
- }
- @end
|