123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- //
- // YMPersonalPageViewController.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/17.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMPersonalPageViewController.h"
- #import "YMPersonalPageViewModel.h"
- #import "YMPersonalPageAlbumView.h"
- #import "YMPersonalPageInfoView.h"
- #import "YMPersonalPageDynamicView.h"
- #import "YMPersonalPageTagView.h"
- #import "YMPersonalPageGiftWallView.h"
- #import "YMPersonalPageAboutView.h"
- @interface YMPersonalPageViewController ()<UIScrollViewDelegate>
- /// 个人主页VM
- @property (nonatomic, strong) YMPersonalPageViewModel *viewModel;
- /// 更多按钮
- @property (nonatomic, strong) UIButton *moreBtn;
- /// 容器滚动视图
- @property (nonatomic, strong) UIScrollView *contentScrollView;
- /// 容器视图
- @property (nonatomic, strong) UIView *contentView;
- /// 相册视图
- @property (nonatomic, strong) YMPersonalPageAlbumView *albumView;
- /// 账号信息等视图
- @property (nonatomic, strong) YMPersonalPageAboutView *aboutView;
- /// 信息视图
- @property (nonatomic, strong) YMPersonalPageInfoView *infoView;
- /// 社交内容堆叠视图
- @property (nonatomic, strong) UIStackView *socialContentStackView;
- /// 动态视图
- @property (nonatomic, strong) YMPersonalPageDynamicView *dynamicView;
- /// 标签视图
- @property (nonatomic, strong) YMPersonalPageTagView *tagView;
- /// 礼物墙视图
- @property (nonatomic, strong) YMPersonalPageGiftWallView *giftWallView;
- /// 编辑资料按钮
- @property (nonatomic, strong) UIButton *editProfileBtn;
- /// 按钮堆叠视图
- @property (nonatomic, strong) UIStackView *otherPersonalPageButtonStackView;
- /// 心动或搭讪按钮
- @property (nonatomic, strong) UIButton *heartbeatOrAccostBtn;
- /// 通话按钮
- @property (nonatomic, strong) UIButton *callBtn;
- /// 私聊按钮
- @property (nonatomic, strong) UIButton *privateChatBtn;
- ///关注按钮
- @property (nonatomic, strong) UIButton *followBtn;
- @property (nonatomic, assign) CGFloat bottomButnHeight;
- @end
- @implementation YMPersonalPageViewController
- @dynamic viewModel;
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.ym_navigationStyle = YMBaseNavigationStyleClearBgWhiteBackArrow;
- [UMengRecordTool umengEventCountWithId:EnterPersonalCenter];
- self.bottomButnHeight = 0;
- }
- - (void)viewDidDisappear:(BOOL)animated{
- [super viewDidDisappear:animated];
- [[YMAudioPlayer sharedInstance] stop];
- }
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self.viewModel getPersonalPageData];
- }
- - (void)ym_setupViews{
- [self setTitle:@"个人详情"];
- [self setRightBarButtonWithCustomView:self.moreBtn];
- [self.view addSubview:self.contentScrollView];
- [self.view sendSubviewToBack:self.contentScrollView];
- [self.contentScrollView addSubview:self.contentView];
- [self.contentView addSubview:self.albumView];
- [self.contentView addSubview:self.aboutView];
-
- WS(weakSelf)
- [self.contentView addSubview:self.infoView];
-
- [self.contentView addSubview:self.socialContentStackView];
- [self.socialContentStackView addArrangedSubview:self.dynamicView];
- [self.socialContentStackView addArrangedSubview:self.tagView];
- [self.socialContentStackView addArrangedSubview:self.giftWallView];
-
- [self.view addSubview:self.otherPersonalPageButtonStackView];
- [self.otherPersonalPageButtonStackView addArrangedSubview:self.followBtn];
- [self.otherPersonalPageButtonStackView addArrangedSubview:self.editProfileBtn];
- [self.otherPersonalPageButtonStackView addArrangedSubview:self.callBtn];
- [self.otherPersonalPageButtonStackView addArrangedSubview:self.heartbeatOrAccostBtn];
- //[self.otherPersonalPageButtonStackView addArrangedSubview:self.privateChatBtn];
-
-
-
- [self.view setNeedsUpdateConstraints];
- [self.view updateConstraintsIfNeeded];
- }
- - (void)updateViewConstraints{
-
- [self.contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.view);
- make.left.equalTo(self.view);
- make.right.equalTo(self.view);
- make.bottom.equalTo(self.view);
- }];
-
- [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.contentScrollView);
- make.width.equalTo(self.contentScrollView.mas_width);
- }];
-
- [self.albumView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.contentView);
- make.left.equalTo(self.contentView);
- make.right.equalTo(self.contentView);
- }];
-
- [self.aboutView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.albumView.mas_bottom).offset(adapt(10));
- make.left.equalTo(self.contentView);
- make.right.equalTo(self.contentView);
- }];
-
- [self.infoView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.aboutView.mas_bottom).offset(adapt(10));
- make.left.equalTo(self.contentView);
- make.right.equalTo(self.contentView);
- }];
-
- [self.socialContentStackView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.infoView.mas_bottom);
- make.left.equalTo(self.contentView);
- make.right.equalTo(self.contentView);
- make.bottom.equalTo(self.contentView).offset(adapt(-100));
- }];
-
-
- [self.dynamicView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.socialContentStackView);
- make.right.equalTo(self.socialContentStackView);
- }];
-
- [self.tagView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.socialContentStackView);
- make.right.equalTo(self.socialContentStackView);
- }];
-
- [self.giftWallView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.socialContentStackView);
- make.right.equalTo(self.socialContentStackView);
- }];
-
- [self.editProfileBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(adapt(180));
- make.height.mas_equalTo(adapt(60));
- }];
- [self.callBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(adapt(180));
- make.height.mas_equalTo(adapt(60));
- }];
-
- [self.otherPersonalPageButtonStackView mas_makeConstraints:^(MASConstraintMaker *make) {
- //make.top.equalTo(self.contentScrollView.mas_bottom).offset(adapt(10));
- make.left.equalTo(self.view).offset(adapt(12));
- make.right.equalTo(self.view).offset(adapt(-12));
- make.height.mas_equalTo(adapt(self.bottomButnHeight));
- make.bottom.equalTo(self.view).offset(Is_iPhoneX ? adapt(-32) : adapt(-12));
- }];
-
- [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.mas_equalTo(adapt(60));
- }];
-
- [self.heartbeatOrAccostBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.mas_equalTo(adapt(60));
- }];
-
- [self.privateChatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.mas_equalTo(adapt(60));
- }];
-
- [super updateViewConstraints];
- }
- - (void)ym_bindViewModel{
- [self.albumView ym_bindViewModel:self.viewModel];
- [self.aboutView ym_bindViewModel:self.viewModel];
- [self.infoView ym_bindViewModel:self.viewModel];
- [self.dynamicView ym_bindViewModel:self.viewModel];
- [self.tagView ym_bindViewModel:self.viewModel];
- [self.giftWallView ym_bindViewModel:self.viewModel];
-
- [self.viewModel getPersonalPageData];
-
- RAC(self.dynamicView, hidden) = RACObserve(self.viewModel, isHideDynamic);
-
- RAC(self.tagView, hidden) = RACObserve(self.viewModel, isHideTag);
-
- RAC(self.giftWallView, hidden) = RACObserve(self.viewModel, isHideGiftWall);
-
- @weakify(self)
- [[[[RACObserve(self.viewModel, isOtherPersonalPage) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber *isOtherPersonalPage) {
- @strongify(self)
- self.bottomButnHeight = adapt(60);
- /// 是否他人主页
- if ([isOtherPersonalPage boolValue]) {
- self.otherPersonalPageButtonStackView.hidden = NO;
- self.followBtn.hidden = NO;
- self.callBtn.hidden = NO;
- self.editProfileBtn.hidden = YES;
- self.heartbeatOrAccostBtn.hidden = NO;
-
- if (([self.viewModel.userGender isEqualToString:@"女"] && !self.viewModel.isFemaleGender) || ([self.viewModel.userGender isEqualToString:@"男"] && self.viewModel.isFemaleGender) ) {
- // 异性,显示通话按钮
- self.callBtn.hidden = NO;
- } else {
- // 同性,不显示底部按钮
- self.bottomButnHeight = adapt(0);
- }
- } else {
- self.otherPersonalPageButtonStackView.hidden = NO;
- self.followBtn.hidden = YES;
- self.callBtn.hidden = YES;
- self.heartbeatOrAccostBtn.hidden = YES;
- self.editProfileBtn.hidden = NO;
- }
- [self.otherPersonalPageButtonStackView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(adapt(self.bottomButnHeight));
- }];
- }];
-
- // [[[[RACObserve(self.viewModel, bottomHidden) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber *bottomHidden) {
- // @strongify(self)
- // if ([bottomHidden boolValue]) {
- // self.editProfileBtn.hidden = NO;
- // }else{
- // self.editProfileBtn.hidden = YES;
- // }
- // }];
-
-
-
- [[[[RACObserve(self.viewModel, heartbeatOrAccostButtonTitle) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString *heartbeatOrAccostButtonTitle) {
- @strongify(self)
- [self.heartbeatOrAccostBtn setTitle:heartbeatOrAccostButtonTitle forState:UIControlStateNormal];
- if([heartbeatOrAccostButtonTitle isEqualToString:@"私聊"]){
- [self.heartbeatOrAccostBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGB(0xFD8887), HexColorFromRGB(0xFD8887)] locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- [self.heartbeatOrAccostBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
- [self.heartbeatOrAccostBtn setBackgroundColor:rgba(253, 104, 165, 1)];
- [self.heartbeatOrAccostBtn setImage:ImageByName(@"ym_personal_page_msg") forState:UIControlStateNormal];
-
- } else {
- [self.heartbeatOrAccostBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGB(0xFFFFFF), HexColorFromRGB(0xFFFFFF)] locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- [self.heartbeatOrAccostBtn setTitleColor:rgba(253, 104, 165, 1) forState:UIControlStateNormal];
- [self.heartbeatOrAccostBtn setBackgroundColor:UIColor.whiteColor];
- [self.heartbeatOrAccostBtn setImage:ImageByName(@"ym_personal_page_dasan")forState:UIControlStateNormal];
- }
- }];
-
- [[[[RACObserve(self.viewModel, heartbeatOrAccostButtonImage) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString *heartbeatOrAccostButtonImage) {
- @strongify(self)
- self.heartbeatOrAccostBtn.imageEdgeInsets = UIEdgeInsetsMake(-self.heartbeatOrAccostBtn.titleLabel.intrinsicContentSize.height, 0, 0, -self.heartbeatOrAccostBtn.titleLabel.intrinsicContentSize.width);
- self.heartbeatOrAccostBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -self.heartbeatOrAccostBtn.imageView.frame.size.width, -self.heartbeatOrAccostBtn.imageView.frame.size.height, 0);
- }];
-
- [[[[RACObserve(self.viewModel, isFollow) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isFollow) {
- @strongify(self)
- if (![isFollow boolValue]) {
- [self.followBtn setTitleColor:rgba(255, 141, 26, 1) forState:UIControlStateNormal];
- [self.followBtn setTitle:@"关注" forState:UIControlStateNormal];
- [self.followBtn setBackgroundColor:rgba(255, 255, 255, 1)];
- [self.followBtn setImage:ImageByName(@"ym_personal_page_followable") forState:UIControlStateNormal];
- }else{
- [self.followBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
- [self.followBtn setBackgroundColor:rgba(255, 141, 26, 1)];
- [self.followBtn setTitle:@"已关注" forState:UIControlStateNormal];
- [self.followBtn setImage:ImageByName(@"ym_personal_page_followed") forState:UIControlStateNormal];
- }
-
- self.followBtn.imageEdgeInsets = UIEdgeInsetsMake(-self.followBtn.titleLabel.intrinsicContentSize.height, 0, 0, -self.followBtn.titleLabel.intrinsicContentSize.width);
- self.followBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -self.followBtn.imageView.frame.size.width, -self.followBtn.imageView.frame.size.height, 0);
- }];
-
- }
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- CGFloat offsetY = scrollView.contentOffset.y;
- CGFloat navSBHeight = kYMStatusBarHeight + 44;
- CGFloat rate = offsetY / navSBHeight;
- CGFloat alpha = (rate <= 1) ? rate : 1;
- UIImage *img;
- if (offsetY > navSBHeight) {
- self.ym_navigationStyle = YMBaseNavigationStyleClearBgBlackBackArrow;
- img = ImageByName(@"ym_personal_page_more_icon_black");
- } else {
- self.ym_navigationStyle = YMBaseNavigationStyleClearBgWhiteBackArrow;
- img = ImageByName(@"ym_personal_page_more_icon_white");
- }
- [self.moreBtn setImage:img forState:(UIControlStateNormal)];
- self.ym_customNavView.backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:alpha];
- }
- - (UIButton *)moreBtn {
- if (!_moreBtn) {
- _moreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_moreBtn setImage:ImageByName(@"ym_personal_page_more_icon_white") forState:UIControlStateNormal];
- WS(weakSelf)
- [[[_moreBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel openMoreAlert];
- }];
- }
- return _moreBtn;
- }
- - (UIScrollView *)contentScrollView{
- if (!_contentScrollView) {
- _contentScrollView = [[UIScrollView alloc] init];
- _contentScrollView.delegate = self;
- _contentScrollView.bounces = NO;
- _contentScrollView.alwaysBounceVertical = YES;
- _contentScrollView.showsVerticalScrollIndicator = NO;
- _contentScrollView.showsHorizontalScrollIndicator = NO;
- _contentScrollView.backgroundColor = UIColor.clearColor;
- _contentScrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
- }
- return _contentScrollView;
- }
- - (UIView *)contentView{
- if (!_contentView) {
- _contentView = [[UIView alloc]init];
- }
- return _contentView;
- }
- - (YMPersonalPageAlbumView *)albumView{
- if (!_albumView) {
- _albumView = [[YMPersonalPageAlbumView alloc]init];
- }
- return _albumView;
- }
- - (YMPersonalPageAboutView *)aboutView {
- if (!_aboutView) {
- _aboutView = [[YMPersonalPageAboutView alloc] init];
- }
- return _aboutView;
- }
- - (YMPersonalPageInfoView *)infoView{
- if (!_infoView) {
- _infoView = [[YMPersonalPageInfoView alloc]init];
- }
- return _infoView;
- }
- - (UIStackView *)socialContentStackView{
- if(!_socialContentStackView){
- _socialContentStackView = [[UIStackView alloc]init];
- _socialContentStackView.translatesAutoresizingMaskIntoConstraints = NO;
- _socialContentStackView.axis = UILayoutConstraintAxisVertical;
- _socialContentStackView.alignment = UIStackViewAlignmentCenter;
- _socialContentStackView.spacing = adapt(10);
- }
- return _socialContentStackView;
- }
- - (YMPersonalPageDynamicView *)dynamicView{
- if (!_dynamicView) {
- _dynamicView = [[YMPersonalPageDynamicView alloc]init];
- _dynamicView.userInteractionEnabled = YES;
- WS(weakSelf)
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
- [_dynamicView addGestureRecognizer:tap];
- [[[tap rac_gestureSignal] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel gotoPersonalDynamic];
- }];
- }
- return _dynamicView;
- }
- - (YMPersonalPageTagView *)tagView{
- if (!_tagView) {
- _tagView = [[YMPersonalPageTagView alloc]init];
- }
- return _tagView;
- }
- - (YMPersonalPageGiftWallView *)giftWallView{
- if (!_giftWallView) {
- _giftWallView = [[YMPersonalPageGiftWallView alloc]init];
- }
- return _giftWallView;
- }
- - (UIButton *)editProfileBtn{
- if (!_editProfileBtn) {
- _editProfileBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _editProfileBtn.titleLabel.font = LCFont(16);
- [_editProfileBtn setTitleColor:MAINGRIDTitleC forState:UIControlStateNormal];
- [_editProfileBtn setTitle:@"编辑资料" forState:UIControlStateNormal];
- [_editProfileBtn ym_setGradientBackgroundWithColors:kMainGradColors locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- _editProfileBtn.layer.cornerRadius = adapt(60)/2;
- _editProfileBtn.layer.masksToBounds = YES;
- _editProfileBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
- [_editProfileBtn setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
- CGFloat margin = 5;
- _editProfileBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -margin, 0, margin);
- WS(weakSelf)
- [[[_editProfileBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel gotoEditProfile];
- }];
- _editProfileBtn.hidden = YES;
- }
- return _editProfileBtn;
- }
- - (UIStackView *)otherPersonalPageButtonStackView{
- if(!_otherPersonalPageButtonStackView){
- _otherPersonalPageButtonStackView = [[UIStackView alloc]init];
- _otherPersonalPageButtonStackView.hidden = NO;
- _otherPersonalPageButtonStackView.backgroundColor = UIColor.clearColor;
- _otherPersonalPageButtonStackView.axis = UILayoutConstraintAxisHorizontal;
- _otherPersonalPageButtonStackView.alignment = UIStackViewAlignmentCenter;
- _otherPersonalPageButtonStackView.spacing = adapt(10);
- }
- return _otherPersonalPageButtonStackView;
- }
- - (UIButton *)heartbeatOrAccostBtn{
- if (!_heartbeatOrAccostBtn) {
- _heartbeatOrAccostBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _heartbeatOrAccostBtn.hidden = YES;
- _heartbeatOrAccostBtn.titleLabel.font = LCFont(14);
- [_heartbeatOrAccostBtn setTitleColor:HexColorFromRGB(0x8167FF) forState:UIControlStateNormal];
- _heartbeatOrAccostBtn.layer.cornerRadius = adapt(60)/2;
- _heartbeatOrAccostBtn.layer.masksToBounds = YES;
- _heartbeatOrAccostBtn.layer.borderColor = HexColorFromRGB(0xEFEEEF).CGColor;
- _heartbeatOrAccostBtn.layer.borderWidth = 1;
- _heartbeatOrAccostBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
- [_heartbeatOrAccostBtn setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
-
-
- _heartbeatOrAccostBtn.imageEdgeInsets = UIEdgeInsetsMake(-_heartbeatOrAccostBtn.titleLabel.intrinsicContentSize.height, 0, 0, -_heartbeatOrAccostBtn.titleLabel.intrinsicContentSize.width);
- _heartbeatOrAccostBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -_heartbeatOrAccostBtn.imageView.frame.size.width, -_heartbeatOrAccostBtn.imageView.frame.size.height, 0);
-
-
- WS(weakSelf)
- [[[_heartbeatOrAccostBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel sendAccostRequest];
- }];
- }
- return _heartbeatOrAccostBtn;
- }
- - (UIButton *)followBtn{
- if (!_followBtn) {
- _followBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _followBtn.titleLabel.font = LCFont(14);
- [_followBtn setTitle:@"关注" forState:UIControlStateNormal];
- [_followBtn setImage:ImageByName(@"ym_personal_page_add") forState:UIControlStateNormal];
- _followBtn.layer.cornerRadius = adapt(60) / 2;
- _followBtn.layer.masksToBounds = YES;
- _followBtn.layer.borderColor = HexColorFromRGB(0xEFEEEF).CGColor;
- _followBtn.layer.borderWidth = 1;
- _followBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
- [_followBtn setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
-
-
- _followBtn.imageEdgeInsets = UIEdgeInsetsMake(-_followBtn.titleLabel.intrinsicContentSize.height, 0, 0, -_followBtn.titleLabel.intrinsicContentSize.width);
- _followBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -_followBtn.imageView.frame.size.width, -_followBtn.imageView.frame.size.height, 0);
-
-
- WS(weakSelf)
- [[[_followBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel followUser];
- }];
- }
- return _followBtn;
- }
- - (UIButton *)callBtn{
- if (!_callBtn) {
- _callBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_callBtn setTitle:@" 视频聊天" forState:(UIControlStateNormal)];
- [_callBtn setImage:ImageByName(@"ym_personal_page_call_icon") forState:UIControlStateNormal];
- [_callBtn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:(UIControlStateNormal)];
- //[_callBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xFF6E79, 1),HexColorFromRGBA(0xFF6E79, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- [_callBtn ym_setGradientBackgroundWithColors:kMainGradColors locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- _callBtn.titleLabel.font = LCFont(14);
- _callBtn.layer.cornerRadius = adapt(60) / 2;
- _callBtn.layer.masksToBounds = YES;
- WS(weakSelf)
- [[[_callBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel callVideo];
- }];
- }
- return _callBtn;
- }
- - (UIButton *)privateChatBtn{
- if (!_privateChatBtn) {
- _privateChatBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_privateChatBtn setBackgroundImage:ImageByName(@"ym_personal_page_siliao") forState:UIControlStateNormal];
- _privateChatBtn.layer.cornerRadius = adapt(60) / 2;
- _privateChatBtn.layer.masksToBounds = YES;
- WS(weakSelf)
- [[[_privateChatBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel gotoPrivateChat];
- }];
- }
- return _privateChatBtn;
- }
- @end
|