完善个人资料页礼物墙,动态

This commit is contained in:
chenshuanglin
2023-03-13 16:26:23 +08:00
parent 616f600617
commit 299395e3c7
27 changed files with 817 additions and 150 deletions

View File

@@ -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 = "<group>"; };
146567E329B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFindNewFriendTableViewCell.h; sourceTree = "<group>"; };
146567E429B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFindNewFriendTableViewCell.m; sourceTree = "<group>"; };
14B65C6329BECD8A00EC02EF /* XPMineMomentTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMomentTableViewCell.h; sourceTree = "<group>"; };
14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineMomentTableViewCell.m; sourceTree = "<group>"; };
14B65C6629BF005F00EC02EF /* XPMineIntimacyViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineIntimacyViewController.h; sourceTree = "<group>"; };
14B65C6729BF005F00EC02EF /* XPMineIntimacyViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineIntimacyViewController.m; sourceTree = "<group>"; };
14C1F15229B86DF0000A960F /* XPMineMoreTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMoreTableViewCell.h; sourceTree = "<group>"; };
14C1F15329B86DF0000A960F /* XPMineMoreTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineMoreTableViewCell.m; sourceTree = "<group>"; };
14C1F15529B874FB000A960F /* XPMineMoreItemTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMoreItemTableViewCell.h; sourceTree = "<group>"; };
@@ -6199,6 +6205,8 @@
14EDBBBA29B6034B001D3E16 /* XPMomentListCollectionViewCell.m */,
14F9796329B71189004BBFEB /* XPMonentsEmptyCollectionViewCell.h */,
14F9796429B71189004BBFEB /* XPMonentsEmptyCollectionViewCell.m */,
14B65C6329BECD8A00EC02EF /* XPMineMomentTableViewCell.h */,
14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */,
);
path = View;
sourceTree = "<group>";
@@ -7307,6 +7315,8 @@
E8D34D6328084E40009C4835 /* XPMineUserInfoGiftWallViewController.m */,
E8998D892859CB6A00C68558 /* XPMineUserInfoGiftWallSubViewController.h */,
E8998D8A2859CB6A00C68558 /* XPMineUserInfoGiftWallSubViewController.m */,
14B65C6629BF005F00EC02EF /* XPMineIntimacyViewController.h */,
14B65C6729BF005F00EC02EF /* XPMineIntimacyViewController.m */,
);
path = MineInfo;
sourceTree = "<group>";
@@ -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 */,

View File

@@ -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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -16,6 +16,8 @@
#import "UserGiftWallInfoModel.h"
@interface XPMineDataGiftCollectionViewCell ()
///
@property (nonatomic, strong) UIView *bgView;
///
@property (nonatomic,strong) NetImageView *giftImageView;
///
@@ -37,20 +39,24 @@
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.bgView];
[self.contentView addSubview:self.giftImageView];
[self.contentView addSubview:self.giftNumberLabel];
}
- (void)initSubViewConstraints {
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.contentView);
}];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(47, 47));
make.top.centerX.mas_equalTo(self.contentView);
make.size.mas_equalTo(CGSizeMake(55, 55));
make.top.mas_equalTo(2);
make.centerX.mas_equalTo(self.contentView);
}];
[self.giftNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.giftImageView.mas_bottom).offset(3);
make.size.mas_equalTo(CGSizeMake(51, 15));
make.top.mas_equalTo(self.giftImageView.mas_bottom).offset(5);
}];
}
@@ -63,6 +69,15 @@
}
}
- (UIView *)bgView {
if (!_bgView) {
_bgView = [[UIView alloc] init];
_bgView.backgroundColor = [ThemeColor colorWithHexString:@"#F3F5FA"];
_bgView.layer.cornerRadius = 8;
}
return _bgView;
}
- (NetImageView *)giftImageView {
if (!_giftImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
@@ -78,10 +93,9 @@
if (!_giftNumberLabel) {
_giftNumberLabel = [[UILabel alloc] init];
_giftNumberLabel.font = [UIFont systemFontOfSize:10];
_giftNumberLabel.textColor = [ThemeColor mainTextColor];
_giftNumberLabel.textColor = [ThemeColor secondTextColor];
_giftNumberLabel.backgroundColor = UIColorFromRGB(0xF1F1FA);
_giftNumberLabel.textAlignment = NSTextAlignmentCenter;
[_giftNumberLabel setCornerWithLeftTopCorner:2 rightTopCorner:6 bottomLeftCorner:6 bottomRightCorner:2 size:CGSizeMake(51, 15)];
}
return _giftNumberLabel;
}

View File

@@ -63,19 +63,19 @@
- (void)initSubViewConstraints {
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.contentView).inset(15);
make.left.right.mas_equalTo(self.contentView).inset(0);
make.top.mas_equalTo(self.contentView);
make.bottom.mas_equalTo(self.contentView).offset(-15);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backImageView).offset(12);
make.left.mas_equalTo(self.backImageView).offset(15);
make.top.mas_equalTo(self.backImageView).offset(12);
}];
[self.arrowButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(13, 22));
make.centerY.mas_equalTo(self.titleLabel);
make.centerY.mas_equalTo(self.titleView);
make.right.mas_equalTo(self.backImageView).offset(-15);
}];
@@ -134,12 +134,7 @@
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.layer.cornerRadius = 10;
_backImageView.backgroundColor =[ThemeColor appCellBackgroundColor];
_backImageView.layer.shadowColor = UIColorFromRGB(0xE4E4E4).CGColor;
_backImageView.layer.shadowOpacity = 1;
_backImageView.layer.shadowOffset = CGSizeMake(0, 2);
_backImageView.layer.shadowRadius = 8;
}
return _backImageView;
}
@@ -148,7 +143,7 @@
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"礼物墙";
_titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_titleLabel.textColor = [ThemeColor mainTextColor];
}
return _titleLabel;
@@ -173,8 +168,8 @@
_titleView.backgroundColor = [UIColor clearColor];
_titleView.titleColor = [ThemeColor secondTextColor];
_titleView.titleSelectedColor = [ThemeColor mainTextColor];
_titleView.titleFont = [UIFont systemFontOfSize:12];
_titleView.titleSelectedFont = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_titleView.titleFont = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_titleView.titleSelectedFont = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.defaultSelectedIndex = 0;
@@ -184,11 +179,9 @@
_titleView.listContainer = self.containerView;
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
lineView.indicatorImageViewSize = CGSizeMake(60, 8);
lineView.verticalMargin = 6;
lineView.indicatorImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFC000), UIColorFromRGB(0xFFD15A)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(60, 8)];
lineView.indicatorImageView.layer.masksToBounds = YES;
lineView.indicatorImageView.layer.cornerRadius = 6;
lineView.indicatorImageViewSize = CGSizeMake(13, 4);
lineView.verticalMargin = 0;
lineView.indicatorImageView.image = [UIImage imageNamed:@"home_segment_indicator"];
_titleView.indicators = @[lineView];
}
return _titleView;

View File

@@ -61,19 +61,19 @@
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backImageView).offset(12);
make.left.mas_equalTo(self.backImageView).offset(15);
make.top.mas_equalTo(self.backImageView).offset(12);
}];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(12);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(18);
make.height.mas_equalTo(47);
make.right.mas_equalTo(self.backImageView).offset(-6);
}];
[self.emptyView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backImageView).inset(10);
make.left.right.mas_equalTo(self.backImageView).inset(18);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(12);
make.height.mas_equalTo(47);
}];
@@ -81,7 +81,7 @@
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(6.5, 11));
make.centerY.mas_equalTo(self.emptyView);
make.right.mas_equalTo(self.emptyView).offset(-5);
make.right.mas_equalTo(self.emptyView).offset(-12);
}];
[self.emptyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -144,7 +144,7 @@
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"技能卡";
_titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_titleLabel.textColor = [ThemeColor mainTextColor];
}
return _titleLabel;

View File

@@ -0,0 +1,17 @@
//
// XPMineIntimacyViewController.h
// xplan-ios
//
// Created by XY on 2023/3/13.
//
#import "MvpViewController.h"
#import <JXPagingView/JXPagerView.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPMineIntimacyViewController : MvpViewController<JXPagerViewListViewDelegate>
@end
NS_ASSUME_NONNULL_END

View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -41,6 +41,7 @@
#import "XPRoomViewController.h"
#import "XPMineUserDataViewController.h"
#import "XPMonentsMineViewController.h"
#import "XPMineIntimacyViewController.h"
@interface XPMineUserInfoViewController ()<XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDelegate, JXCategoryViewDelegate,JXPagerViewDelegate, XPMineUserDataViewControllerDelegate, JXPagerMainTableViewGestureDelegate>
@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,8 +244,10 @@
UIViewController *viewController;
if (index == 0) {
return self.userDataVC;
} else {
} else if (index == 1) {
return self.monentsVC;
}else {
return self.intimacyVC;
}
return (id <JXPagerViewListViewDelegate>)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;
@@ -436,11 +439,9 @@
_titleView.listContainer = (id<JXCategoryViewListContainer>)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)];
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<NSString *> *)titles {
if (!_titles) {
_titles = @[@"资料", @"动态"];
_titles = @[@"资料", @"动态", @"亲密关系"];
}
return _titles;
}
@@ -487,5 +488,11 @@
return _monentsVC;
}
- (XPMineIntimacyViewController *)intimacyVC {
if (!_intimacyVC) {
_intimacyVC = [[XPMineIntimacyViewController alloc] init];
}
return _intimacyVC;
}
@end

View File

@@ -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];

View File

@@ -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;

View File

@@ -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,8 +208,15 @@
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) {
@@ -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];
- (UIView *)onlineView {
if (!_onlineView) {
_onlineView = [[UIView alloc] init];
_onlineView.backgroundColor = [ThemeColor appMainColor];
_onlineView.layer.cornerRadius = 10;
_onlineView.clipsToBounds = YES;
_onlineView.hidden = YES;
}
return _onlineButton;
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;
}

View File

@@ -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

View File

@@ -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;
///

View File

@@ -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

View File

@@ -25,7 +25,7 @@
///
@property (nonatomic,strong) UILabel *topicLabel;
///
@property (nonatomic,strong) UILabel *timeLabel;
@property (nonatomic,strong,readwrite) UILabel *timeLabel;
@end
@implementation XPMoentsTopicView

View File

@@ -21,6 +21,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong) MonentsInfoModel *monentsInfo;
///代理
@property (nonatomic,weak) id<XPMonentsContentViewDelegate> delegate;
///以是否是个人资料页动态初始化
- (instancetype)initWithCome:(BOOL)isMine;
@end
NS_ASSUME_NONNULL_END

View File

@@ -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;
}

View File

@@ -20,6 +20,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,copy) NSArray<MonentsPicInfoModel *> *dynamicResList;
///代理
@property (nonatomic,weak) id<XPMonentsPhotoViewDelegate> delegate;
///以是否是个人资料页动态初始化
- (instancetype)initWithCome:(BOOL)isMine;
@end
NS_ASSUME_NONNULL_END

View File

@@ -36,6 +36,10 @@
///
@property (nonatomic,strong) NetImageView *ninthImageView;
@property (nonatomic,strong) NSArray<NetImageView *> *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;

View File

@@ -22,6 +22,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong) MonentsInfoModel *monentsInfo;
///代理
@property (nonatomic,weak) id<XPMonentsTooBarViewDelegate> delegate;
///以是否是个人资料页动态初始化
- (instancetype)initWithCome:(BOOL)isMine;
@end
NS_ASSUME_NONNULL_END

View File

@@ -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,6 +81,7 @@
}
- (void)initSubViewConstraints {
if (self.isMine == NO) {
[self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self).offset(70);
make.top.mas_equalTo(self).offset(24);
@@ -127,6 +136,57 @@
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 {

View File

@@ -0,0 +1,35 @@
//
// XPMineMomentTableViewCell.h
// xplan-ios
//
// Created by XY on 2023/3/13.
//
#import <UIKit/UIKit.h>
@class MonentsInfoModel;
NS_ASSUME_NONNULL_BEGIN
@protocol XPMineMomentTableViewCellDelegate <NSObject>
///点击了点赞
- (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<XPMineMomentTableViewCellDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,276 @@
//
// XPMineMomentTableViewCell.m
// xplan-ios
//
// Created by XY on 2023/3/13.
//
#import "XPMineMomentTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///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 ()<XPMonentsTooBarViewDelegate, XPMonentsTooBarViewDelegate, XPMonentsPhotoViewDelegate, SDPhotoBrowserDelegate, XPMonentsUserInfoViewDelegate, XPMonentsContentViewDelegate>
/// 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

View File

@@ -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 ()<UITableViewDelegate, UITableViewDataSource, XPMonentsTableViewCellDelegate, XPMonentsMineProtocol, XPMonentsDetailViewControllerDelegate>
@interface XPMonentsMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMonentsMineProtocol, XPMonentsDetailViewControllerDelegate, XPMineMomentTableViewCellDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@@ -64,14 +64,19 @@
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.datasource.count > 0 ? self.datasource.count : 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
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<MonentsInfoModel *> *)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;