From 299395e3c79492d0897490bc0688aaf8460a19f2 Mon Sep 17 00:00:00 2001 From: chenshuanglin <1273934588@qq.com> Date: Mon, 13 Mar 2023 16:26:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=B8=AA=E4=BA=BA=E8=B5=84?= =?UTF-8?q?=E6=96=99=E9=A1=B5=E7=A4=BC=E7=89=A9=E5=A2=99=EF=BC=8C=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xplan-ios.xcodeproj/project.pbxproj | 12 + .../Contents.json | 22 ++ .../user_mine_profile_edit@2x.png | Bin 0 -> 1124 bytes .../user_mine_profile_edit@3x.png | Bin 0 -> 1292 bytes .../XPMineDataGiftCollectionViewCell.m | 26 +- .../MineInfo/XPMineDataGiftTableViewCell.m | 31 +- .../XPMineDataSkillCardTableViewCell.m | 10 +- .../MineInfo/XPMineIntimacyViewController.h | 17 ++ .../MineInfo/XPMineIntimacyViewController.m | 45 +++ .../MineInfo/XPMineUserDataViewController.m | 4 +- .../MineInfo/XPMineUserInfoViewController.m | 37 ++- .../MineInfo/XPMineUserInfoCustomNavView.m | 2 +- .../MineInfo/XPMineUserInfoGiftView.m | 12 +- .../MineInfo/XPMineUserInfoHeaderView.m | 74 +++-- .../Monents/Presenter/XPMonentsLayoutConfig.h | 11 + .../Monents/Presenter/XPMonentsLayoutConfig.m | 93 ++++++ .../Monents/View/SubViews/XPMoentsTopicView.h | 3 + .../Monents/View/SubViews/XPMoentsTopicView.m | 2 +- .../View/SubViews/XPMonentsContentView.h | 4 + .../View/SubViews/XPMonentsContentView.m | 13 +- .../View/SubViews/XPMonentsPhotoView.h | 4 + .../View/SubViews/XPMonentsPhotoView.m | 14 +- .../View/SubViews/XPMonentsTooBarView.h | 4 + .../View/SubViews/XPMonentsTooBarView.m | 168 +++++++---- .../Monents/View/XPMineMomentTableViewCell.h | 35 +++ .../Monents/View/XPMineMomentTableViewCell.m | 276 ++++++++++++++++++ .../View/XPMonentsMineViewController.m | 48 ++- 27 files changed, 817 insertions(+), 150 deletions(-) create mode 100644 xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/Contents.json create mode 100644 xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/user_mine_profile_edit@2x.png create mode 100644 xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/user_mine_profile_edit@3x.png create mode 100644 xplan-ios/Main/Mine/View/MineInfo/XPMineIntimacyViewController.h create mode 100644 xplan-ios/Main/Mine/View/MineInfo/XPMineIntimacyViewController.m create mode 100644 xplan-ios/Main/Monents/View/XPMineMomentTableViewCell.h create mode 100644 xplan-ios/Main/Monents/View/XPMineMomentTableViewCell.m diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 78daeeaa..52c0f299 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -12,6 +12,8 @@ 146567DC29B1D6A900A1F5B9 /* XPNewHomeNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567DB29B1D6A900A1F5B9 /* XPNewHomeNavView.m */; }; 146567E229B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567E129B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m */; }; 146567E529B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567E429B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m */; }; + 14B65C6529BECD8A00EC02EF /* XPMineMomentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */; }; + 14B65C6829BF005F00EC02EF /* XPMineIntimacyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14B65C6729BF005F00EC02EF /* XPMineIntimacyViewController.m */; }; 14C1F15429B86DF0000A960F /* XPMineMoreTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15329B86DF0000A960F /* XPMineMoreTableViewCell.m */; }; 14C1F15729B874FB000A960F /* XPMineMoreItemTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15629B874FB000A960F /* XPMineMoreItemTableViewCell.m */; }; 14C1F15A29B876EC000A960F /* XPMineMoreItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15929B876EC000A960F /* XPMineMoreItemModel.m */; }; @@ -1310,6 +1312,10 @@ 146567E129B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNewHomeHeaderView.m; sourceTree = ""; }; 146567E329B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFindNewFriendTableViewCell.h; sourceTree = ""; }; 146567E429B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFindNewFriendTableViewCell.m; sourceTree = ""; }; + 14B65C6329BECD8A00EC02EF /* XPMineMomentTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMomentTableViewCell.h; sourceTree = ""; }; + 14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineMomentTableViewCell.m; sourceTree = ""; }; + 14B65C6629BF005F00EC02EF /* XPMineIntimacyViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineIntimacyViewController.h; sourceTree = ""; }; + 14B65C6729BF005F00EC02EF /* XPMineIntimacyViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineIntimacyViewController.m; sourceTree = ""; }; 14C1F15229B86DF0000A960F /* XPMineMoreTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMoreTableViewCell.h; sourceTree = ""; }; 14C1F15329B86DF0000A960F /* XPMineMoreTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineMoreTableViewCell.m; sourceTree = ""; }; 14C1F15529B874FB000A960F /* XPMineMoreItemTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMoreItemTableViewCell.h; sourceTree = ""; }; @@ -6199,6 +6205,8 @@ 14EDBBBA29B6034B001D3E16 /* XPMomentListCollectionViewCell.m */, 14F9796329B71189004BBFEB /* XPMonentsEmptyCollectionViewCell.h */, 14F9796429B71189004BBFEB /* XPMonentsEmptyCollectionViewCell.m */, + 14B65C6329BECD8A00EC02EF /* XPMineMomentTableViewCell.h */, + 14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */, ); path = View; sourceTree = ""; @@ -7307,6 +7315,8 @@ E8D34D6328084E40009C4835 /* XPMineUserInfoGiftWallViewController.m */, E8998D892859CB6A00C68558 /* XPMineUserInfoGiftWallSubViewController.h */, E8998D8A2859CB6A00C68558 /* XPMineUserInfoGiftWallSubViewController.m */, + 14B65C6629BF005F00EC02EF /* XPMineIntimacyViewController.h */, + 14B65C6729BF005F00EC02EF /* XPMineIntimacyViewController.m */, ); path = MineInfo; sourceTree = ""; @@ -10164,6 +10174,7 @@ E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */, 9B86D87D2817EA0900494FCD /* XPNobleSettingViewController.m in Sources */, E82D5C70276AE60000858D6D /* HeadwearModel.m in Sources */, + 14B65C6529BECD8A00EC02EF /* XPMineMomentTableViewCell.m in Sources */, E8A03DEC276301EF0098D9EA /* XPCandyTreeRankView.m in Sources */, E880B3A1278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.m in Sources */, 9B3C181A292CE4FA003AF543 /* XPAnchorPKMatchView.m in Sources */, @@ -10244,6 +10255,7 @@ E81A65312834E53600F55894 /* XPMonentsLatestViewController.m in Sources */, 18F404BB2760982000A6C548 /* ChatLimitModel.m in Sources */, E8A30BE828534A63003B4873 /* XPSessionFindNewTableViewCell.m in Sources */, + 14B65C6829BF005F00EC02EF /* XPMineIntimacyViewController.m in Sources */, 9BE9F10527FF04CF00667200 /* XPAnchorFansTaskTableViewCell.m in Sources */, E8E859D328264C2300EE4857 /* DDTTYLogger.m in Sources */, 9B92A33C2797E38100AD168F /* XPMineHeadItemTableViewCell.m in Sources */, diff --git a/xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/Contents.json b/xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/Contents.json new file mode 100644 index 00000000..ff8e3a65 --- /dev/null +++ b/xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "user_mine_profile_edit@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "user_mine_profile_edit@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/user_mine_profile_edit@2x.png b/xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/user_mine_profile_edit@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d6bd0b1d5129a163c2bec7e6b027b8cc680e481b GIT binary patch literal 1124 zcmeAS@N?(olHy`uVBq!ia0vp^HXzKw3=&b&bO2I}#X;^)4C~IxyaaMwQX@Rme0>?T zfNTy1#`a7G7LXDkmI7i12Id8f3?RLXAh88Za9NuL%m_9}VfX!)F+l2PfKP}kkp4d+ zf#aO)g+R{-l?3?(GcYo-vT<ggL88X23InweW!yZ8qL zg@nc@BqgV$XXO@^R(AJKm^@|9!d-j!?LTnv(2<9a9zT8d{KeakpT7M3`)^s~k!}VC zrfg3a#}JR>OQ&ZR-!c$rd&^>=a&SUJ^37eB%xp6+TiZ?+@hW)V^zVQF%J;8Ws=w4F zvYlTXyS6M``}oDxk9m(f_7uwWw8tIK)Z6~tpFxe~xmW$cBkyw)s!GWR8n zvv=ABncFSevG9e*$C(d~DNTA_d&kS^%C3ejiJTAoa^AOW+w9~2Evv$zzh!U0`Vso%egs<%@4Vf7*8G`sYb(6W{EJmwL9CHEqAda`D7(>P?%E2lPcI{%SCn zi8uUKyHDfmOSw}K1wX$(S3YTGd*XA^srNJVZf!axYIpJ3>TDd%{LxiMxI`OH;+~*4C}N&?r3n z!5rPUk3KxET9{)~wt;cojU+{jbo+B6w^){M{B?fW2VQTJ4fk>=U&mzfCn0i8r2hN5f0vH+YnluIZ&mZ^ga~OK!dEkZkUC zlee(!@#3owvMh~m^S&-S&$64n>*?hap8~Hvvi!lHe=_TL!b+`Wz(md9>FVdQ&MBb@ E0QP}%vH$=8 literal 0 HcmV?d00001 diff --git a/xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/user_mine_profile_edit@3x.png b/xplan-ios/Assets.xcassets/user_mine_profile_edit.imageset/user_mine_profile_edit@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..7ca8d2fc250f7502eed6b353116555980d12dfb7 GIT binary patch literal 1292 zcmeAS@N?(olHy`uVBq!ia0vp^Q6S903?%u>HW~ma#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh1{xMv&M7Cb(?W0%imoq|mdbdpnT&5a1Ky3Z(y! zB=Gd=p@%>}`fBpS;?y7@0Fc#!J zT^vIq4sV^AS%1kv;25)t!wzN@8SC6tV*EO{qE?FA26S~Cs{5b+m@TSKruxjJH=id> z_}{H=ym__m2K=skn zf@$K>3)Y4SJ~fh2-TK&Xu1vdHsk>m2os6!%_St=AM*^ZJ&8?JAI(eS^ZichZR@QkI zc1Nb2|2u7_mC6DueYVvqoF*&f*xUt$f(q?@iqBEelQu@5{<`KzKaYMg+tRsS z@Vi~M`=>kYZ@B&R{an`bDI3Xlyp0Rbt5e!!e%$t8wYK?-8V&E0SKWC^E@qoQGf&^N zrPFT7?W?Zq?@F9HaiLUl7f)42i}b`(k7lVmCEux7RbLj&-&>e0TDR?KN$CX-bEVC) zr&)PTuJwAX3%%r+e77THQ&xq^y%tJb)omN z{FHlL7iGI2T#zw8Cx2t6nq`*GfrXYEFG_EYS4n$(;m(bKMTTu3lARmXR-8X^UW9d5 zGlyN^GK~w3R;h>1H~9oEkbdP-|2H_mT;#>9T{e6FDzA{{D)EdBiLd+pyF2=|NQQW! z$eyb2YAm@X)?6k020F836LuZf6O)a#K9zPMwXj?H{m&VGY{6dBFNwKdn6dG@So!X` zuhy}Zb9<>@I_7i1ujtq7SYOGReM{ahS-|=3{EDc}`}S}?+y3t1)>*c@`JS$|{(ngD z?g2G#&T>o1ug*tXo9lhM%*8gQPTw67{_^Zoy~dLhD*RI3Ddm3pm0ysNSac<+z#*k* zO=^KedPz%0!H3MEnCzkxIYlOU1q<>^coT~%lZu`umjtF3>`g1t%qW?fS;ClIl$%p_ dQ#RlAzkJdZ)kWgD)}V5W!PC{xWt~$(699 + +NS_ASSUME_NONNULL_BEGIN + +@interface XPMineIntimacyViewController : MvpViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/MineInfo/XPMineIntimacyViewController.m b/xplan-ios/Main/Mine/View/MineInfo/XPMineIntimacyViewController.m new file mode 100644 index 00000000..5f7e6a6b --- /dev/null +++ b/xplan-ios/Main/Mine/View/MineInfo/XPMineIntimacyViewController.m @@ -0,0 +1,45 @@ +// +// XPMineIntimacyViewController.m +// xplan-ios +// +// Created by XY on 2023/3/13. +// + +#import "XPMineIntimacyViewController.h" + +@interface XPMineIntimacyViewController () + +@property (nonatomic,strong) UITableView *tableView; +@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView); + +@end + +@implementation XPMineIntimacyViewController + +- (BOOL)isHiddenNavBar { + return YES;; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +#pragma mark - JXPagingViewListViewDelegate +- (UIView *)listView { + return self.view; +} + +- (UIScrollView *)listScrollView { + return self.tableView; +} + +- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback { + self.scrollCallback = callback; +} + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + self.scrollCallback(scrollView); +} + +@end diff --git a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserDataViewController.m b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserDataViewController.m index 4b3e3b81..3abc564c 100644 --- a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserDataViewController.m +++ b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserDataViewController.m @@ -109,9 +109,9 @@ } } } else { - CGFloat itemHeight = 65; + CGFloat itemHeight = 82; CGFloat topHeight = 100; - return itemHeight * 3 + 10 * 3 + topHeight + 25; + return itemHeight * 3 + 12 * 2 + topHeight + 25; } } diff --git a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m index fb2a4ed9..e4abe138 100644 --- a/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m +++ b/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m @@ -41,6 +41,7 @@ #import "XPRoomViewController.h" #import "XPMineUserDataViewController.h" #import "XPMonentsMineViewController.h" +#import "XPMineIntimacyViewController.h" @interface XPMineUserInfoViewController () @property (nonatomic, strong) JXCategoryTitleView *titleView; @@ -63,6 +64,8 @@ @property (nonatomic,strong) XPMineUserDataViewController *userDataVC; ///动态 @property (nonatomic,strong) XPMonentsMineViewController *monentsVC; +/// 亲密关系 +@property (nonatomic,strong) XPMineIntimacyViewController *intimacyVC; ///声音秀 @property (nonatomic,strong) XPMineUserInfoVoiceCardView *voiceView; @end @@ -241,9 +244,11 @@ UIViewController *viewController; if (index == 0) { return self.userDataVC; - } else { + } else if (index == 1) { return self.monentsVC; - } + }else { + return self.intimacyVC; + } return (id )viewController; } @@ -341,10 +346,8 @@ _uid = uid; if (_uid > 0) { if (_uid == [AccountInfoStorage instance].getUid.integerValue) { - [self.navView.editButton setTitle:@"编辑" forState:UIControlStateNormal]; - [self.navView.editButton setImage:[UIImage new] forState:UIControlStateNormal]; + [self.navView.editButton setImage:[UIImage imageNamed:@"user_mine_profile_edit"] forState:UIControlStateNormal]; } else { - [self.navView.editButton setTitle:@"" forState:UIControlStateNormal]; [self.navView.editButton setImage:[UIImage imageNamed:@"mine_user_info_edit"] forState:UIControlStateNormal]; } self.navView.editButton.selected = _uid == [AccountInfoStorage instance].getUid.integerValue; @@ -423,8 +426,8 @@ _titleView.backgroundColor = [UIColor whiteColor]; _titleView.titleColor = [ThemeColor textThirdColor]; _titleView.titleSelectedColor = [ThemeColor mainTextColor]; - _titleView.titleFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:12]; - _titleView.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:16]; + _titleView.titleFont = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + _titleView.titleSelectedFont = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium]; _titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter; _titleView.contentScrollViewClickTransitionAnimationEnabled = NO; _titleView.defaultSelectedIndex = 0; @@ -435,13 +438,11 @@ _titleView.titles = self.titles; _titleView.listContainer = (id)self.pagingView.listContainerView; - JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init]; - lineView.indicatorImageViewSize = CGSizeMake(16, 6); - lineView.verticalMargin = 7; - lineView.indicatorImageView.layer.masksToBounds = YES; - lineView.indicatorImageView.layer.cornerRadius = 3; - lineView.indicatorImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFC000), UIColorFromRGB(0xFFF9DB)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(16, 6)]; - _titleView.indicators = @[lineView]; + JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init]; + lineView.indicatorImageViewSize = CGSizeMake(13, 4); + lineView.verticalMargin = 5; + lineView.indicatorImageView.image = [UIImage imageNamed:@"home_segment_indicator"]; + _titleView.indicators = @[lineView]; } return _titleView; } @@ -460,7 +461,7 @@ - (NSArray *)titles { if (!_titles) { - _titles = @[@"资料", @"动态"]; + _titles = @[@"资料", @"动态", @"亲密关系"]; } return _titles; } @@ -487,5 +488,11 @@ return _monentsVC; } +- (XPMineIntimacyViewController *)intimacyVC { + if (!_intimacyVC) { + _intimacyVC = [[XPMineIntimacyViewController alloc] init]; + } + return _intimacyVC; +} @end diff --git a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoCustomNavView.m b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoCustomNavView.m index a9ee594e..d1748747 100644 --- a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoCustomNavView.m +++ b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoCustomNavView.m @@ -73,7 +73,7 @@ - (UIButton *)backButton { if (!_backButton) { _backButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_backButton setImage:[UIImage imageNamed:@"common_nav_back"] forState:UIControlStateNormal]; + [_backButton setImage:[UIImage imageNamed:@"home_search_white_back"] forState:UIControlStateNormal]; _backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; [_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_backButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10]; diff --git a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m index e1638567..d3e1920c 100644 --- a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m +++ b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoGiftView.m @@ -39,12 +39,14 @@ - (void)initSubViewConstraints { [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { - make.edges.mas_equalTo(self); + make.left.mas_equalTo(20); + make.right.mas_equalTo(-20); + make.top.bottom.mas_equalTo(0); }]; } #pragma mark - UICollectionViewDelegate And UICollectionViewDatasource - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { - return self.datasource.count > 0? CGSizeMake(51, 65) : CGSizeMake(KScreenWidth - 30, 65 * 3 + 30); + return self.datasource.count > 0? CGSizeMake(72, 82) : CGSizeMake(KScreenWidth - 30, 82 * 3 + 12*2); } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { @@ -76,9 +78,9 @@ - (UICollectionView *)collectionView{ if (!_collectionView) { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.minimumInteritemSpacing = (KScreenWidth - 15 *2 - 10 * 2 -51 * 5) / 3.0;; - layout.minimumLineSpacing = 10; - layout.sectionInset = UIEdgeInsetsMake(0, 10, 0, 10); + layout.minimumInteritemSpacing = (KScreenWidth - 20 *2 -72 * 4) / 3.0;; + layout.minimumLineSpacing = 12; +// layout.sectionInset = UIEdgeInsetsMake(0, 10, 0, 10); _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; _collectionView.dataSource = self; _collectionView.delegate = self; diff --git a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m index 17ea38ac..73f8fbf8 100644 --- a/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m +++ b/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m @@ -20,6 +20,7 @@ #import "NSArray+Safe.h" #import "XCHUDTool.h" #import "StatisticsServiceHelper.h" +#import "XPNoteView.h" ///Model #import "UserInfoModel.h" @@ -48,7 +49,9 @@ ///sex @property (nonatomic,strong) UIImageView *sexImageView; ///正在直播中 -@property (nonatomic,strong) UIButton *onlineButton; +@property (nonatomic,strong) UIView *onlineView; +///音符 +@property (nonatomic,strong) XPNoteView *noteView; /// @property (nonatomic,strong) UIStackView *idStackView; ///靓号 @@ -105,18 +108,19 @@ [self addSubview:self.pageButton]; [self.userInfoView addSubview:self.avatarImageView]; + [self.userInfoView addSubview:self.lineView]; [self.userInfoView addSubview:self.fansNumLabel]; [self.userInfoView addSubview:self.signBackView]; - [self.userInfoView addSubview:self.lineView]; - [self.userInfoView addSubview:self.nickStackView]; [self.userInfoView addSubview:self.idStackView]; [self.userInfoView addSubview:self.tagStackView]; + [self.userInfoView addSubview:self.onlineView]; + + [self.onlineView addSubview:self.noteView]; [self.nickStackView addArrangedSubview:self.nobleImageView]; [self.nickStackView addArrangedSubview:self.nameLabel]; [self.nickStackView addArrangedSubview:self.sexImageView]; - [self.nickStackView addArrangedSubview:self.onlineButton]; [self.idStackView addArrangedSubview:self.beautifulImageViw]; [self.idStackView addArrangedSubview:self.idLabel]; @@ -154,7 +158,7 @@ [self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.mas_equalTo(self); make.bottom.mas_equalTo(self); - make.height.mas_equalTo(195); + make.height.mas_equalTo(185); }]; @@ -173,9 +177,9 @@ }]; [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.mas_equalTo(self.userInfoView).inset(15); + make.left.right.mas_equalTo(self.userInfoView).inset(0); make.bottom.mas_equalTo(self.userInfoView); - make.height.mas_equalTo(1); + make.height.mas_equalTo(20); }]; [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -204,9 +208,16 @@ make.size.mas_equalTo(CGSizeMake(15, 15)); }]; - [self.onlineButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(55, 18)); + [self.onlineView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(20, 20)); + make.right.mas_equalTo(self.avatarImageView.mas_right).offset(-2); + make.bottom.mas_equalTo(self.avatarImageView.mas_bottom).offset(-2); }]; + + [self.noteView mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(0); + make.width.height.mas_equalTo(10); + }]; [self.idStackView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.nickStackView); @@ -391,7 +402,14 @@ - (void)setRoomUid:(NSString *)roomUid { _roomUid = roomUid; - self.onlineButton.hidden = _roomUid.length <= 0; + if (_roomUid.length <= 0) { + self.onlineView.hidden = YES; + self.avatarImageView.layer.borderColor = UIColor.whiteColor.CGColor; + }else{ + self.onlineView.hidden = NO; + self.avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor; + } + } - (UIImageView *)coverImageView { @@ -409,9 +427,6 @@ _userInfoView.backgroundColor = [UIColor whiteColor]; // _userInfoView.layer.masksToBounds = YES; _userInfoView.layer.cornerRadius = 20; -// CAShapeLayer * layer = [CAShapeLayer layer]; -// layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 79) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)].CGPath; -// _signBackView.layer.mask = layer; } return _userInfoView; } @@ -493,18 +508,25 @@ return _idLabel; } -- (UIButton *)onlineButton { - if (!_onlineButton) { - _onlineButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_onlineButton setTitle:@"直播中" forState:UIControlStateNormal]; - [_onlineButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal]; - _onlineButton.titleLabel.font = [UIFont systemFontOfSize:12]; - [_onlineButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; - _onlineButton.layer.masksToBounds = YES; - _onlineButton.layer.cornerRadius = 10; - [_onlineButton addTarget:self action:@selector(onlineButtonAction:) forControlEvents:UIControlEventTouchUpInside]; - } - return _onlineButton; +- (UIView *)onlineView { + if (!_onlineView) { + _onlineView = [[UIView alloc] init]; + _onlineView.backgroundColor = [ThemeColor appMainColor]; + _onlineView.layer.cornerRadius = 10; + _onlineView.clipsToBounds = YES; + _onlineView.hidden = YES; + } + return _onlineView; +} + +- (XPNoteView *)noteView { + if (!_noteView) { + _noteView = [[XPNoteView alloc] init]; + _noteView.pillarColor = [UIColor blackColor]; + _noteView.pillarWidth = 1.5; + [_noteView startAnimation]; + } + return _noteView; } - (SDCycleScrollView *)cycleScrollView { @@ -640,7 +662,7 @@ - (UIView *)lineView { if (!_lineView) { _lineView = [[UIView alloc] init]; - _lineView.backgroundColor = [ThemeColor dividerColor]; + _lineView.backgroundColor = UIColor.whiteColor; } return _lineView; } diff --git a/xplan-ios/Main/Monents/Presenter/XPMonentsLayoutConfig.h b/xplan-ios/Main/Monents/Presenter/XPMonentsLayoutConfig.h index 0e8df611..b12b3b4d 100644 --- a/xplan-ios/Main/Monents/Presenter/XPMonentsLayoutConfig.h +++ b/xplan-ios/Main/Monents/Presenter/XPMonentsLayoutConfig.h @@ -29,6 +29,11 @@ NS_ASSUME_NONNULL_BEGIN #define kMONENTS_COMMENT_REPLY_LEFT_PADDING (kMONENTS_COMMENT_LEFT_PADDING + kMONENTS_COMMENT_RIGHT_PADDING + kMONENTS_COMMENT_AVATAR_NICK_PADDING) ///回复这左边的间隙 #define KMONENTS_COMMENT_REPLY_MAX_WIDTH (KMONENTS_COMMENT_MAX_WIDTH - KMONENTS_COMMENT_REPLY_AVATAR_WIDTH - kMONENTS_COMMENT_AVATAR_NICK_PADDING) ///评论回复内容的最大宽度 +#pragma mark - 个人资料页动态 +#define kMineMONENTS_CONTENT_LEFT_PADDING 18 +#define kMineMONENTS_CONTENT_MAX_WIDTH (KScreenWidth - kMineMONENTS_CONTENT_LEFT_PADDING*2) +#define kMineMONENTS_TIME_HEIGHT 14 + @class MonentsInfoModel, MonentsCommentModel; @interface XPMonentsLayoutConfig : NSObject + (void)layoutMonentsModel:(MonentsInfoModel *)monents; @@ -36,6 +41,12 @@ NS_ASSUME_NONNULL_BEGIN + (CGFloat)monentsContentHeight:(MonentsInfoModel *)monents; ///计算评论的高度 + (CGFloat)commentCommentRowHeight:(MonentsCommentModel * )comment; + +/// 个人资料页的动态高度 ++ (void)layoutMineMonentsModel:(MonentsInfoModel *)monents; ++ (CGFloat)mineMonentsContentHeight:(MonentsInfoModel *)monents; ++ (CGFloat)mineMonentsPicHeight:(MonentsInfoModel *)monents; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Monents/Presenter/XPMonentsLayoutConfig.m b/xplan-ios/Main/Monents/Presenter/XPMonentsLayoutConfig.m index 874641f2..cf5f0cc9 100644 --- a/xplan-ios/Main/Monents/Presenter/XPMonentsLayoutConfig.m +++ b/xplan-ios/Main/Monents/Presenter/XPMonentsLayoutConfig.m @@ -15,6 +15,99 @@ @implementation XPMonentsLayoutConfig +/// 个人资料页的动态高度 ++ (void)layoutMineMonentsModel:(MonentsInfoModel *)monents { + CGFloat rowHeight = kMONENTS_CONTENT_SPACAE_HEIGHT; + ///文字内容的高度 + rowHeight += [self mineMonentsContentHeight:monents]; + if (monents.content.length > 0) { + rowHeight += kMONENTS_CONTENT_SPACAE_HEIGHT; + } + ///时间高度 + rowHeight += kMineMONENTS_TIME_HEIGHT; + if (monents.type == MonentsContentType_Picture) { + rowHeight += kMONENTS_CONTENT_SPACAE_HEIGHT; + } + ///图片的高度 + rowHeight += [self monentsPicHeight:monents]; + ///话题的高度 + if (monents.worldId > 0) { + rowHeight += kMONENTS_CONTENT_SPACAE_HEIGHT; + rowHeight += kMONENTS_TEXT_TOPIC_HEIGHT; + } + ///底部操作栏的高度 + rowHeight += kMONENTS_TOOL_BAR_HEIGHT; + monents.rowHeight = rowHeight; +} + ++ (CGFloat)mineMonentsContentHeight:(MonentsInfoModel *)monents { + if (monents.content.length <= 0) { + monents.contentHeight = 0; + return 0; + } + ///计算文本的高度 + if (!monents.contentAttribute) { + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init]; + if (monents.squareTop ) {//动态/广场 + NSTextAttachment * attachment = [[NSTextAttachment alloc] init]; + attachment.bounds = CGRectMake(0, 0, 25 * 1.3 ,10 * 1.3); + attachment.image = [UIImage imageNamed:@"monents_info_top"]; + NSAttributedString * starAttribute = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)attachment]; + [attributedString insertAttributedString:starAttribute atIndex:0]; + } + [attributedString appendAttributedString:[self creatStrAttrByStr:monents.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]]; + attributedString.yy_lineSpacing = 5; + attributedString.yy_lineBreakMode = NSLineBreakByWordWrapping; + monents.contentAttribute = attributedString; + } + + YYTextContainer *container = [YYTextContainer new]; + container.size = CGSizeMake(kMineMONENTS_CONTENT_MAX_WIDTH, CGFLOAT_MAX); + container.maximumNumberOfRows = 0; + YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:monents.contentAttribute]; + monents.numberOfText = layout.rowCount; + CGFloat foldHeight = 0; + if (layout.rowCount > 6) { + foldHeight = kMONENTS_FOLD_HEIGHT; + NSInteger numberOfLines = monents.isFold ? 6 : 0; + container.maximumNumberOfRows = numberOfLines; + } + YYTextLayout *realLayout = [YYTextLayout layoutWithContainer:container text:monents.contentAttribute]; + CGFloat contentHeight = realLayout.textBoundingSize.height; + monents.contentHeight =contentHeight; + return contentHeight + foldHeight; +} + ++ (CGFloat)mineMonentsPicHeight:(MonentsInfoModel *)monents { + ///计算图片的高度 + NSInteger picCount = monents.dynamicResList.count; + CGFloat picHeight = 0; + if (picCount == 0) { + picHeight = 0; + } else if(picCount == 1) { + picHeight = kMONENTS_PIC_ONE_WIDTH; + } else if(picCount == 2) { + picHeight = (kMineMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE) / 2; + } else { + if (picCount > 9) { + picCount = 9; + } + CGFloat itemWidth = (kMineMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE * 2) / 3; + NSInteger page = picCount % 3; + NSInteger line = picCount / 3; + if (page == 0) { + picHeight = itemWidth * line + (line -1)* kMONENTS_PIC_SPACE; + } else { + picHeight = itemWidth * (line +1) + line * kMONENTS_PIC_SPACE; + } + } + monents.picHeight = picHeight; + return picHeight; +} + + +#pragma mark ----- 分割线 + + (void)layoutMonentsModel:(MonentsInfoModel *)monents { CGFloat rowHeight = kMONENTS_USER_INFO_HEIGHT; ///用户信息和文字之间的间隙 diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicView.h b/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicView.h index f21273e0..a8f287c3 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicView.h +++ b/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicView.h @@ -10,6 +10,9 @@ NS_ASSUME_NONNULL_BEGIN @class MonentsInfoModel; @interface XPMoentsTopicView : UIView +///显示时间 +@property (nonatomic,strong,readonly) UILabel *timeLabel; + @property (nonatomic,strong) MonentsInfoModel *monentsInfo; @end diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicView.m b/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicView.m index 397f392f..e03adda2 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMoentsTopicView.m @@ -25,7 +25,7 @@ ///显示话题 @property (nonatomic,strong) UILabel *topicLabel; ///显示时间 -@property (nonatomic,strong) UILabel *timeLabel; +@property (nonatomic,strong,readwrite) UILabel *timeLabel; @end @implementation XPMoentsTopicView diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsContentView.h b/xplan-ios/Main/Monents/View/SubViews/XPMonentsContentView.h index 1ac47cb3..62a8b487 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsContentView.h +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsContentView.h @@ -21,6 +21,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong) MonentsInfoModel *monentsInfo; ///代理 @property (nonatomic,weak) id delegate; + +///以是否是个人资料页动态初始化 +- (instancetype)initWithCome:(BOOL)isMine; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsContentView.m b/xplan-ios/Main/Monents/View/SubViews/XPMonentsContentView.m index 41acd71a..f8624beb 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsContentView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsContentView.m @@ -22,6 +22,10 @@ @property (nonatomic,strong) UILabel *contentLabel; ///折叠的按钮 @property (nonatomic,strong) UIButton *foldButton; + +///是否是个人资料页的动态 +@property (nonatomic, assign) BOOL isMine; + @end @@ -36,6 +40,11 @@ return self; } +- (instancetype)initWithCome:(BOOL)isMine { + self.isMine = isMine; + return [self initWithFrame:CGRectZero]; +} + #pragma mark - Private Method - (void)initSubViews { [self addSubview:self.stackView]; @@ -95,7 +104,7 @@ self.foldButton.selected = !_monentsInfo.isFold; if (monentsInfo.numberOfText <= 0) { YYTextContainer *container = [YYTextContainer new]; - container.size = CGSizeMake(kMONENTS_CONTENT_MAX_WIDTH, CGFLOAT_MAX); + container.size = CGSizeMake(self.isMine ? kMineMONENTS_CONTENT_MAX_WIDTH : kMONENTS_CONTENT_MAX_WIDTH, CGFLOAT_MAX); container.maximumNumberOfRows = 0; YYTextLayout * layout = [YYTextLayout layoutWithContainer:container text:self.contentLabel.attributedText]; if (layout.rowCount > 6) { @@ -157,7 +166,7 @@ _contentLabel.numberOfLines = 0; _contentLabel.font = [UIFont systemFontOfSize:15]; _contentLabel.textColor = UIColorRGBAlpha(0x333333, 1); - _contentLabel.preferredMaxLayoutWidth = kMONENTS_CONTENT_MAX_WIDTH; + _contentLabel.preferredMaxLayoutWidth = self.isMine ? kMineMONENTS_CONTENT_MAX_WIDTH : kMONENTS_CONTENT_MAX_WIDTH; _contentLabel.lineBreakMode = NSLineBreakByWordWrapping; } diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.h b/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.h index 3b52e854..e67007b1 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.h +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.h @@ -20,6 +20,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,copy) NSArray *dynamicResList; ///代理 @property (nonatomic,weak) id delegate; + +///以是否是个人资料页动态初始化 +- (instancetype)initWithCome:(BOOL)isMine; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.m b/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.m index e8042a34..c575d23f 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsPhotoView.m @@ -36,6 +36,10 @@ ///第九个 @property (nonatomic,strong) NetImageView *ninthImageView; @property (nonatomic,strong) NSArray *subViewArray; + +///是否是个人资料页的动态 +@property (nonatomic, assign) BOOL isMine; + @end @@ -48,6 +52,12 @@ } return self; } + +- (instancetype)initWithCome:(BOOL)isMine { + self.isMine = isMine; + return [self initWithFrame:CGRectZero]; +} + #pragma mark - Private Method - (void)initSubViews { [self addSubview:self.firstImageView]; @@ -93,7 +103,7 @@ self.firstImageView.imageUrl = picInfo.resUrl; } else if(_dynamicResList.count == 2) { self.firstImageView.hidden = NO; - CGFloat itemWidth = (kMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE) / 2; + CGFloat itemWidth = (self.isMine ? kMineMONENTS_CONTENT_MAX_WIDTH : kMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE) / 2; [self.firstImageView mas_remakeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth)); make.left.top.mas_equalTo(self); @@ -122,7 +132,7 @@ } } - CGFloat itemWidth = (kMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE * 2) / 3; + CGFloat itemWidth = (self.isMine ? kMineMONENTS_CONTENT_MAX_WIDTH : kMONENTS_CONTENT_MAX_WIDTH - kMONENTS_PIC_SPACE * 2) / 3; for (int i = 0; i < self.subViewArray.count; i++) { NSInteger page = i % 3; NSInteger line = i / 3; diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsTooBarView.h b/xplan-ios/Main/Monents/View/SubViews/XPMonentsTooBarView.h index 923b8d46..abc4b1c7 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsTooBarView.h +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsTooBarView.h @@ -22,6 +22,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong) MonentsInfoModel *monentsInfo; ///代理 @property (nonatomic,weak) id delegate; + +///以是否是个人资料页动态初始化 +- (instancetype)initWithCome:(BOOL)isMine; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsTooBarView.m b/xplan-ios/Main/Monents/View/SubViews/XPMonentsTooBarView.m index b0ca8270..5f330527 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsTooBarView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsTooBarView.m @@ -45,6 +45,9 @@ ///分割线 @property (nonatomic,strong) UIView * lineView; +///是否是个人资料页的动态 +@property (nonatomic, assign) BOOL isMine; + @end @implementation XPMonentsTooBarView @@ -58,6 +61,11 @@ return self; } +- (instancetype)initWithCome:(BOOL)isMine { + self.isMine = isMine; + return [self initWithFrame:CGRectZero]; +} + #pragma mark - Private Method - (void)initSubViews { [self addSubview:self.reportButton]; @@ -73,60 +81,112 @@ } - (void)initSubViewConstraints { - [self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.mas_equalTo(self).offset(70); - make.top.mas_equalTo(self).offset(24); - make.size.mas_equalTo(CGSizeMake(22, 22)); - }]; - - [self.likeView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.mas_equalTo(self.likeButton.mas_left); - make.height.mas_equalTo(22); - make.centerY.mas_equalTo(self.reportButton); - make.right.mas_equalTo(self.commentView.mas_left).offset(-12); - }]; - - [self.likeLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.mas_equalTo(self.likeView.mas_right).offset(-3); - make.centerY.mas_equalTo(self.likeView); - }]; - - [self.likeButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(22, 22)); - make.centerY.mas_equalTo(self.likeView); - make.right.mas_equalTo(self.likeLabel.mas_left).offset(-3); - }]; - - [self.commentView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.mas_equalTo(self.commentButton.mas_left).offset(-2); - make.height.mas_equalTo(22); - make.centerY.mas_equalTo(self.reportButton); - make.right.mas_equalTo(self.shareButton.mas_left).offset(-12); - }]; - - - [self.commentButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(22, 22)); - make.centerY.mas_equalTo(self.commentView); - make.right.mas_equalTo(self.commentLabel.mas_left).offset(-2); - }]; - - [self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.mas_equalTo(self.commentView.mas_right).offset(-3); - make.centerY.mas_equalTo(self.commentView); - }]; - - [self.shareButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(22, 22)); - make.right.mas_equalTo(self).offset(-32); - make.centerY.mas_equalTo(self.reportButton); - }]; - - [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.mas_equalTo(self).inset(16); - make.bottom.mas_equalTo(self); - make.height. mas_equalTo(1); - }]; + if (self.isMine == NO) { + [self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self).offset(70); + make.top.mas_equalTo(self).offset(24); + make.size.mas_equalTo(CGSizeMake(22, 22)); + }]; + + [self.likeView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.likeButton.mas_left); + make.height.mas_equalTo(22); + make.centerY.mas_equalTo(self.reportButton); + make.right.mas_equalTo(self.commentView.mas_left).offset(-12); + }]; + + [self.likeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.likeView.mas_right).offset(-3); + make.centerY.mas_equalTo(self.likeView); + }]; + + [self.likeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(22, 22)); + make.centerY.mas_equalTo(self.likeView); + make.right.mas_equalTo(self.likeLabel.mas_left).offset(-3); + }]; + + [self.commentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.commentButton.mas_left).offset(-2); + make.height.mas_equalTo(22); + make.centerY.mas_equalTo(self.reportButton); + make.right.mas_equalTo(self.shareButton.mas_left).offset(-12); + }]; + + + [self.commentButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(22, 22)); + make.centerY.mas_equalTo(self.commentView); + make.right.mas_equalTo(self.commentLabel.mas_left).offset(-2); + }]; + + [self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.commentView.mas_right).offset(-3); + make.centerY.mas_equalTo(self.commentView); + }]; + + [self.shareButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(22, 22)); + make.right.mas_equalTo(self).offset(-32); + make.centerY.mas_equalTo(self.reportButton); + }]; + + [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self).inset(16); + make.bottom.mas_equalTo(self); + make.height. mas_equalTo(1); + }]; + }else{ + [self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self).offset(-20); + make.top.mas_equalTo(self).offset(24); + make.size.mas_equalTo(CGSizeMake(22, 22)); + }]; + + [self.likeView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(18); + make.height.mas_equalTo(22); + make.centerY.mas_equalTo(self.reportButton); + make.right.mas_equalTo(self.likeLabel.mas_right); + }]; + + [self.likeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.likeButton.mas_right).offset(3); + make.centerY.mas_equalTo(self.likeView); + }]; + + [self.likeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(22, 22)); + make.centerY.mas_equalTo(self.likeView); + make.left.mas_equalTo(self.likeView.mas_left); + }]; + + [self.commentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.commentLabel.mas_right).offset(-2); + make.height.mas_equalTo(22); + make.centerY.mas_equalTo(self.reportButton); + make.left.mas_equalTo(self.likeView.mas_left).offset(65); + }]; + + [self.commentButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(22, 22)); + make.centerY.mas_equalTo(self.commentView); + make.left.mas_equalTo(self.commentView.mas_left).offset(2); + }]; + + [self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.commentButton.mas_right).offset(3); + make.centerY.mas_equalTo(self.commentView); + }]; + + [self.shareButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(22, 22)); + make.left.mas_equalTo(self.commentView.mas_left).offset(65); + make.centerY.mas_equalTo(self.reportButton); + }]; + + self.lineView.hidden = YES; + } } #pragma mark - Event Response - (void)commonButtonAction:(UIButton *)sender { diff --git a/xplan-ios/Main/Monents/View/XPMineMomentTableViewCell.h b/xplan-ios/Main/Monents/View/XPMineMomentTableViewCell.h new file mode 100644 index 00000000..f5c14b87 --- /dev/null +++ b/xplan-ios/Main/Monents/View/XPMineMomentTableViewCell.h @@ -0,0 +1,35 @@ +// +// XPMineMomentTableViewCell.h +// xplan-ios +// +// Created by XY on 2023/3/13. +// + +#import + +@class MonentsInfoModel; +NS_ASSUME_NONNULL_BEGIN + +@protocol XPMineMomentTableViewCellDelegate + +///点击了点赞 +- (void)xPMonentsTableViewCellDidClickLike:(MonentsInfoModel *)monentsInfo; +///点击了删除 +- (void)xPMonentsTableViewCellDidClicDelete:(MonentsInfoModel *)monentsInfo; +@optional +///点击了评论 +- (void)xPMonentsTableViewCellDidClicCommon:(MonentsInfoModel *)monentsInfo; +///点击了展开 +- (void)xPMonentsTableViewCellDidClicFold:(MonentsInfoModel *)monentsInfo; + +@end + +@interface XPMineMomentTableViewCell : UITableViewCell + +@property (nonatomic,strong) MonentsInfoModel *monentsInfo; +///代理 +@property (nonatomic,weak) id delegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Monents/View/XPMineMomentTableViewCell.m b/xplan-ios/Main/Monents/View/XPMineMomentTableViewCell.m new file mode 100644 index 00000000..9b997775 --- /dev/null +++ b/xplan-ios/Main/Monents/View/XPMineMomentTableViewCell.m @@ -0,0 +1,276 @@ +// +// XPMineMomentTableViewCell.m +// xplan-ios +// +// Created by XY on 2023/3/13. +// + +#import "XPMineMomentTableViewCell.h" +///Third +#import + +///Tool +#import "ThemeColor.h" +#import "NetImageView.h" +#import "XPMonentsLayoutConfig.h" +#import "SDPhotoBrowser.h" +#import "XCCurrentVCStackManager.h" +#import "NSArray+Safe.h" +#import "NSString+Utils.h" +///Model +#import "MonentsInfoModel.h" +///View +#import "XPMonentsUserInfoView.h" +#import "XPMonentsPhotoView.h" +#import "XPMonentsTooBarView.h" +#import "XPMoentsTopicView.h" +#import "XPMonentsContentView.h" +#import "XPMonentsLayoutConfig.h" +#import "XPMonentTopicContainerViewController.h" +#import "XPMineUserInfoViewController.h" +#import "XPRoomViewController.h" + +@interface XPMineMomentTableViewCell () +///显示颜色的 有的时候stackView 不能显示颜色 +@property (nonatomic,strong) UIView * backView; +///容器 +@property (nonatomic,strong) UIStackView *stackView; + +///显示内容的 +@property (nonatomic,strong) XPMonentsContentView *textView; +///图片 +@property (nonatomic,strong) XPMonentsPhotoView *photoView; +///显示底部的操作栏 +@property (nonatomic,strong) XPMonentsTooBarView *toolBarView; +///话题 +@property (nonatomic,strong) XPMoentsTopicView *topicView; +///显示时间 +@property (nonatomic,strong) UILabel *timeLabel; +///分割线 +@property (nonatomic, strong) UIView *separatorView; + +@end + +@implementation XPMineMomentTableViewCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + [self initSubViews]; + [self initSubViewConstraints]; + } + return self; +} + +#pragma mark - Private Method +- (void)initSubViews { + self.backgroundColor = [UIColor clearColor]; + self.selectionStyle = UITableViewCellSelectionStyleNone; + [self.contentView addSubview:self.backView]; + + [self.backView addSubview:self.stackView]; + [self.backView addSubview:self.toolBarView]; + + [self.stackView addArrangedSubview:self.textView]; + [self.stackView addArrangedSubview:self.timeLabel]; + [self.stackView addArrangedSubview:self.photoView]; + [self.stackView addArrangedSubview:self.topicView]; +} + +- (void)initSubViewConstraints { + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.contentView); + }]; + + [self.textView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(20); + }]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(kMineMONENTS_TIME_HEIGHT); + }]; + + [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.backView).offset(kMineMONENTS_CONTENT_LEFT_PADDING); + make.right.mas_equalTo(self.backView).offset(-kMineMONENTS_CONTENT_LEFT_PADDING); + make.top.mas_equalTo(self.contentView.mas_top).offset(kMONENTS_CONTENT_SPACAE_HEIGHT); + }]; + + [self.topicView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(kMONENTS_TEXT_TOPIC_HEIGHT); + }]; + + [self.toolBarView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self.backView); + make.top.mas_equalTo(self.stackView.mas_bottom); + make.height.mas_equalTo(kMONENTS_TOOL_BAR_HEIGHT); + }]; +} +#pragma mark - XPMonentsUserInfoViewDelegate +- (void)xPMonentsUserInfoView:(XPMonentsUserInfoView *)view didClickEnterRoom:(MonentsInfoModel *)monents { + if (monents.inRoomUid.integerValue > 0) { + [XPRoomViewController openRoom:monents.inRoomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; + } +} + +- (void)xPMonentsUserInfoView:(XPMonentsUserInfoView *)view didClickAvatar:(MonentsInfoModel *)monents { + XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; + userInfoVC.uid = monents.uid.integerValue; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:userInfoVC animated:YES]; +} + +#pragma mark - XPMonentsTooBarViewDelegate +- (void)xPMonentsTooBarView:(XPMonentsTooBarView *)view didClickLike:(MonentsInfoModel *)monentsInfo { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsTableViewCellDidClickLike:)]) { + [self.delegate xPMonentsTableViewCellDidClickLike:monentsInfo]; + } +} + +- (void)xPMonentsTooBarView:(XPMonentsTooBarView *)view didClickDelete:(MonentsInfoModel *)monentsInfo { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsTableViewCellDidClicDelete:)]) { + [self.delegate xPMonentsTableViewCellDidClicDelete:self.monentsInfo]; + } +} + +- (void)xPMonentsTooBarView:(XPMonentsTooBarView *)view didClickCommon:(MonentsInfoModel *)monentsInfo { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsTableViewCellDidClicCommon:)]) { + [self.delegate xPMonentsTableViewCellDidClicCommon:self.monentsInfo]; + } +} + +#pragma mark - XPMonentsContentViewDelegate +- (void)xPMonentsContentView:(XPMonentsContentView *)view didClickFold:(MonentsInfoModel *)monentsInfo { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsTableViewCellDidClicFold:)]) { + [self.delegate xPMonentsTableViewCellDidClicFold:monentsInfo]; + } +} + +#pragma mark - SDPhotoBrowserDelegate +- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index { + MonentsPicInfoModel *picinfo = [self.monentsInfo.dynamicResList safeObjectAtIndex1:index]; + return [NSURL URLWithString:picinfo.resUrl]; +} + +- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index { + return [UIImageConstant defalutBannerPlaceholder]; +} + +#pragma mark - XPMonentsPhotoViewDelegate +- (void)xPMonentsPhotoView:(XPMonentsPhotoView *)view didClickImage:(NSInteger)index { + NSInteger count = self.monentsInfo.dynamicResList.count; + SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init]; + browser.sourceImagesContainerView = self; + browser.delegate = self; + browser.imageCount = count; + browser.currentImageIndex = index; + browser.isMe = NO; + [browser show]; +} + +#pragma mark - Event Response +- (void)didTapTopicRecognizer { + if (self.monentsInfo.worldId > 0) { + XPMonentTopicContainerViewController * topicListVC = [[XPMonentTopicContainerViewController alloc] init]; + topicListVC.worldId = [NSString stringWithFormat:@"%ld", self.monentsInfo.worldId]; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:topicListVC animated:YES]; + } +} + +#pragma mark - Getters And Setters +- (void)setMonentsInfo:(MonentsInfoModel *)monentsInfo { + _monentsInfo = monentsInfo; + if (_monentsInfo) { + self.textView.monentsInfo = _monentsInfo; + self.timeLabel.text = [NSString stringWithTimeStamp:_monentsInfo.publishTime]; + self.photoView.dynamicResList = _monentsInfo.dynamicResList; + + if (_monentsInfo.worldId > 0) { + self.topicView.monentsInfo = _monentsInfo; + self.topicView.hidden = NO; + }else{ + self.topicView.hidden = YES; + } + self.topicView.timeLabel.text = @""; + self.toolBarView.monentsInfo = _monentsInfo; + if (_monentsInfo.type == MonentsContentType_Picture) { + self.photoView.hidden = NO; + CGFloat picHeight = _monentsInfo.picHeight <=0 ? [XPMonentsLayoutConfig mineMonentsPicHeight:_monentsInfo] : _monentsInfo.picHeight; + [self.photoView mas_updateConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(picHeight); + }]; + } else { + self.photoView.hidden = YES; + [self.photoView mas_updateConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(0); + }]; + } + + CGFloat contentHeight = [XPMonentsLayoutConfig mineMonentsContentHeight:_monentsInfo]; + [self.textView mas_updateConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(contentHeight); + }]; + } +} + +- (UIView *)backView { + if (!_backView) { + _backView = [[UIView alloc] init]; + _backView.backgroundColor = [ThemeColor appCellBackgroundColor]; + } + return _backView; +} + +- (XPMonentsPhotoView *)photoView { + if (!_photoView) { + _photoView = [[XPMonentsPhotoView alloc] initWithCome:YES]; + _photoView.delegate = self; + } + return _photoView; +} + +- (UIStackView *)stackView { + if (!_stackView) { + _stackView = [[UIStackView alloc] init]; + _stackView.axis = UILayoutConstraintAxisVertical; + _stackView.distribution = UIStackViewDistributionFill; + _stackView.alignment = UIStackViewAlignmentFill; + _stackView.spacing = kMONENTS_CONTENT_SPACAE_HEIGHT; + } + return _stackView; +} + +- (XPMonentsContentView *)textView { + if (!_textView) { + _textView = [[XPMonentsContentView alloc] initWithCome:YES]; + _textView.delegate = self; + } + return _textView; +} + +- (XPMoentsTopicView *)topicView { + if (!_topicView) { + _topicView = [[XPMoentsTopicView alloc] init]; + UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapTopicRecognizer)]; + [_topicView addGestureRecognizer:tap]; + } + return _topicView; +} + +- (XPMonentsTooBarView *)toolBarView { + if (!_toolBarView) { + _toolBarView = [[XPMonentsTooBarView alloc] initWithCome:YES]; + _toolBarView.delegate = self; + } + return _toolBarView; +} + +- (UILabel *)timeLabel { + if (!_timeLabel) { + _timeLabel = [[UILabel alloc] init]; + _timeLabel.font = [UIFont systemFontOfSize:12]; + _timeLabel.textColor = [ThemeColor textThirdColor]; + } + return _timeLabel; +} + +@end + diff --git a/xplan-ios/Main/Monents/View/XPMonentsMineViewController.m b/xplan-ios/Main/Monents/View/XPMonentsMineViewController.m index c2e02eb0..5ec9756b 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsMineViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsMineViewController.m @@ -21,11 +21,11 @@ #import "XPMonentMinePresenter.h" #import "XPMonentsMineProtocol.h" ///View -#import "XPMonentsTableViewCell.h" +#import "XPMineMomentTableViewCell.h" #import "XPMonentsEmptyTableViewCell.h" #import "XPMonentsDetailViewController.h" -@interface XPMonentsMineViewController () +@interface XPMonentsMineViewController () ///列表 @property (nonatomic,strong) UITableView *tableView; ///数据源 @@ -64,14 +64,19 @@ } #pragma mark - UITableViewDelegate And UITableViewDataSource + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return self.datasource.count > 0 ? self.datasource.count : 1; +} + - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return self.datasource.count > 0 ? self.datasource.count : 1; + return 1; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row]; - [XPMonentsLayoutConfig layoutMonentsModel:monentInfo]; + MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.section]; + [XPMonentsLayoutConfig layoutMineMonentsModel:monentInfo]; return monentInfo.rowHeight; } return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight; @@ -79,8 +84,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.datasource.count > 0) { - XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])]; - MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; + XPMineMomentTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineMomentTableViewCell class])]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.section]; cell.delegate = self; cell.monentsInfo = monentsInfo; return cell; @@ -93,18 +98,33 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.datasource.count > 0) { XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init]; - MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row]; + MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.section]; detailVC.monentsInfo = monentsInfo; detailVC.delegate = self; [self.navigationController pushViewController:detailVC animated:YES]; } } + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + return 12; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + UIView *headerView = [[UIView alloc] init]; + headerView.backgroundColor = [ThemeColor colorWithHexString:@"#F8F8FB"]; + return headerView; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + return 0.01; +} + #pragma mark - XPMonentsTableViewCellDelegate -- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo { +- (void)xPMonentsTableViewCellDidClickLike:(MonentsInfoModel *)monentsInfo { [self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]]; } -- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicDelete:(MonentsInfoModel *)monentsInfo { +- (void)xPMonentsTableViewCellDidClicDelete:(MonentsInfoModel *)monentsInfo { [TTPopup alertWithMessage:@"删除后不可恢复\n确定删除该动态吗?" confirmHandler:^{ [self.presenter deleteMonents:monentsInfo.dynamicId worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]]; } cancelHandler:^{ @@ -112,7 +132,7 @@ }]; } -- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo { +- (void)xPMonentsTableViewCellDidClicFold:(MonentsInfoModel *)monentsInfo { __block MonentsInfoModel * monentsInfos; [self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { if (obj.dynamicId.integerValue == monentsInfo.dynamicId.integerValue) { @@ -191,6 +211,7 @@ #pragma mark - Getters And Setters - (void)setDynamicInfo:(NSArray *)dynamicInfo { + [self.datasource removeAllObjects]; [self.datasource addObjectsFromArray:dynamicInfo]; [self.tableView reloadData]; } @@ -206,7 +227,10 @@ if (@available(iOS 11.0, *)) { _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; } - [_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])]; + if (@available(iOS 15.0, *)) { + _tableView.sectionHeaderTopPadding = 0; + } + [_tableView registerClass:[XPMineMomentTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineMomentTableViewCell class])]; [_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])]; } return _tableView;