首页直播中动效

This commit is contained in:
chenshuanglin
2023-03-13 19:50:02 +08:00
parent a147c43450
commit 4463b2f551
9 changed files with 128 additions and 25 deletions

View File

@@ -13,6 +13,7 @@
146567E229B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567E129B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m */; }; 146567E229B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567E129B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m */; };
146567E529B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567E429B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m */; }; 146567E529B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567E429B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m */; };
14B65C6529BECD8A00EC02EF /* XPMineMomentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */; }; 14B65C6529BECD8A00EC02EF /* XPMineMomentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */; };
14B65C6B29BF439E00EC02EF /* home_living.svga in Resources */ = {isa = PBXBuildFile; fileRef = 14B65C6A29BF439E00EC02EF /* home_living.svga */; };
14C1F15429B86DF0000A960F /* XPMineMoreTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15329B86DF0000A960F /* XPMineMoreTableViewCell.m */; }; 14C1F15429B86DF0000A960F /* XPMineMoreTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15329B86DF0000A960F /* XPMineMoreTableViewCell.m */; };
14C1F15729B874FB000A960F /* XPMineMoreItemTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15629B874FB000A960F /* XPMineMoreItemTableViewCell.m */; }; 14C1F15729B874FB000A960F /* XPMineMoreItemTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15629B874FB000A960F /* XPMineMoreItemTableViewCell.m */; };
14C1F15A29B876EC000A960F /* XPMineMoreItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15929B876EC000A960F /* XPMineMoreItemModel.m */; }; 14C1F15A29B876EC000A960F /* XPMineMoreItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15929B876EC000A960F /* XPMineMoreItemModel.m */; };
@@ -1313,6 +1314,7 @@
146567E429B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFindNewFriendTableViewCell.m; 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>"; }; 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>"; }; 14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineMomentTableViewCell.m; sourceTree = "<group>"; };
14B65C6A29BF439E00EC02EF /* home_living.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = home_living.svga; sourceTree = "<group>"; };
14C1F15229B86DF0000A960F /* XPMineMoreTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMoreTableViewCell.h; 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>"; }; 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>"; }; 14C1F15529B874FB000A960F /* XPMineMoreItemTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMoreItemTableViewCell.h; sourceTree = "<group>"; };
@@ -7556,6 +7558,7 @@
E8A1E45C276220B100B294CA /* Sources */ = { E8A1E45C276220B100B294CA /* Sources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
14B65C6A29BF439E00EC02EF /* home_living.svga */,
E887531529BB1B4F0017A41A /* candy_tree.mp4 */, E887531529BB1B4F0017A41A /* candy_tree.mp4 */,
E839806729027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga */, E839806729027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga */,
E897AC0228AF9DDE003B3587 /* sailing_prize_cowry.svga */, E897AC0228AF9DDE003B3587 /* sailing_prize_cowry.svga */,
@@ -9349,6 +9352,7 @@
E8A1E461276220DA00B294CA /* candyTree.svga in Resources */, E8A1E461276220DA00B294CA /* candyTree.svga in Resources */,
E80EC82528ACD84000D133C5 /* emoji_61@2x.png in Resources */, E80EC82528ACD84000D133C5 /* emoji_61@2x.png in Resources */,
E80EC81528ACD84000D133C5 /* emoji_145@2x.png in Resources */, E80EC81528ACD84000D133C5 /* emoji_145@2x.png in Resources */,
14B65C6B29BF439E00EC02EF /* home_living.svga in Resources */,
E80EC85428ACD84000D133C5 /* emoji_165@2x.png in Resources */, E80EC85428ACD84000D133C5 /* emoji_165@2x.png in Resources */,
E80EC88728ACD84000D133C5 /* emoji_29@2x.png in Resources */, E80EC88728ACD84000D133C5 /* emoji_29@2x.png in Resources */,
E80EC83728ACD84000D133C5 /* emoji_112@2x.png in Resources */, E80EC83728ACD84000D133C5 /* emoji_112@2x.png in Resources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "home_chat@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_chat@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -10,10 +10,17 @@
@class HomeRecommendRoomModel; @class HomeRecommendRoomModel;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol XPFindNewFriendTableViewCellDelegate <NSObject>
@end
@interface XPFindNewFriendTableViewCell : UITableViewCell @interface XPFindNewFriendTableViewCell : UITableViewCell
@property (nonatomic, strong) HomeRecommendRoomModel *roomInfo; @property (nonatomic, strong) HomeRecommendRoomModel *roomInfo;
@property (nonatomic, weak) id<XPFindNewFriendTableViewCellDelegate> delegate;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -8,6 +8,8 @@
#import "XPFindNewFriendTableViewCell.h" #import "XPFindNewFriendTableViewCell.h"
/// Third /// Third
#import <Masonry.h> #import <Masonry.h>
#import <SVGAParser.h>
#import <SVGAPlayer.h>
/// Tool /// Tool
#import "NetImageView.h" #import "NetImageView.h"
#import "ThemeColor.h" #import "ThemeColor.h"
@@ -33,7 +35,12 @@
/// ///
@property (nonatomic, strong) UILabel *signLabel; @property (nonatomic, strong) UILabel *signLabel;
/// /Ta /// /Ta
@property (nonatomic, strong) XPButton *livingBtn; @property (nonatomic, strong) SVGAPlayer *livingView;
@property (nonatomic, strong) UIImageView *chatImageView;
@property (nonatomic, strong) UILabel *statusLabel;
@property (nonatomic, strong) UIStackView *statusStackView;
@end @end
@@ -59,6 +66,14 @@
[self initSubViews]; [self initSubViews];
[self initSubViewConstraints]; [self initSubViewConstraints];
SVGAParser *parser = [[SVGAParser alloc] init];
[parser parseWithNamed:@"home_living" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
self.livingView.videoItem = videoItem;
[self.livingView startAnimation];
}
} failureBlock:nil];
} }
return self; return self;
} }
@@ -71,14 +86,16 @@
[self.bgView addSubview:self.nameStackView]; [self.bgView addSubview:self.nameStackView];
[self.bgView addSubview:self.constellationStackView]; [self.bgView addSubview:self.constellationStackView];
[self.bgView addSubview:self.signLabel]; [self.bgView addSubview:self.signLabel];
[self.bgView addSubview:self.livingBtn]; [self.bgView addSubview:self.livingView];
[self.bgView addSubview:self.chatImageView];
[self.bgView addSubview:self.statusLabel];
[self.nameStackView addArrangedSubview:self.nobleImageView]; [self.nameStackView addArrangedSubview:self.nobleImageView];
[self.nameStackView addArrangedSubview:self.nickLabel]; [self.nameStackView addArrangedSubview:self.nickLabel];
[self.constellationStackView addArrangedSubview:self.sexBtn]; [self.constellationStackView addArrangedSubview:self.sexBtn];
[self.constellationStackView addArrangedSubview:self.constellationLabel]; [self.constellationStackView addArrangedSubview:self.constellationLabel];
} }
- (void)initSubViewConstraints { - (void)initSubViewConstraints {
@@ -125,9 +142,19 @@
make.bottom.mas_equalTo(self.avatarImageView.mas_bottom).offset(-4); make.bottom.mas_equalTo(self.avatarImageView.mas_bottom).offset(-4);
}]; }];
[self.livingBtn mas_makeConstraints:^(MASConstraintMaker *make) { [self.livingView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-15); make.right.mas_equalTo(-15);
make.centerY.mas_equalTo(self.bgView); make.centerY.mas_equalTo(self.bgView).mas_offset(-8);
make.size.mas_equalTo(CGSizeMake(20, 20));
}];
[self.chatImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.livingView);
}];
[self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.livingView.mas_bottom).offset(2);
make.centerX.mas_equalTo(self.livingView);
}]; }];
} }
@@ -141,8 +168,9 @@
[self.sexBtn setTitle:@"22" forState:UIControlStateNormal]; [self.sexBtn setTitle:@"22" forState:UIControlStateNormal];
self.constellationLabel.text = @"巨蟹座"; self.constellationLabel.text = @"巨蟹座";
self.signLabel.text = @"我是个默认的个性签名"; self.signLabel.text = @"我是个默认的个性签名";
[self.livingBtn setTitle:@"直播中" forState:UIControlStateNormal]; self.livingView.hidden = NO;
[self.livingBtn setImage:[UIImage imageNamed:@"home_living"] forState:UIControlStateNormal]; self.statusLabel.text = @"直播中";
// self.statusLabel.text = @"和TA聊";
} }
- (UIView *)bgView { - (UIView *)bgView {
@@ -252,15 +280,42 @@
return _signLabel; return _signLabel;
} }
- (XPButton *)livingBtn { - (SVGAPlayer *)livingView {
if (!_livingBtn) { if (!_livingView) {
_livingBtn = [XPButton buttonWithType:UIButtonTypeCustom]; _livingView = [[SVGAPlayer alloc] init];
_livingBtn.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular]; _livingView.hidden = YES;
[_livingBtn setTitleColor:[ThemeColor textThirdColor] forState:UIControlStateNormal];
_livingBtn.imagePosition = XPButtonImagePositionTop;
_livingBtn.imageTitleSpace = 5;
} }
return _livingBtn; return _livingView;
}
- (UIImageView *)chatImageView {
if (!_chatImageView) {
_chatImageView = [[UIImageView alloc] init];
_chatImageView.contentMode = UIViewContentModeScaleAspectFit;
_chatImageView.image = [UIImage imageNamed:@"home_chat"];
_chatImageView.hidden = YES;
}
return _chatImageView;
}
- (UILabel *)statusLabel {
if (!_statusLabel) {
_statusLabel = [[UILabel alloc] init];
_statusLabel.textColor = [ThemeColor textThirdColor];
_statusLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular];
}
return _statusLabel;
}
- (UIStackView *)statusStackView {
if (!_statusStackView) {
_statusStackView = [[UIStackView alloc] init];
_statusStackView.axis = UILayoutConstraintAxisVertical;
_statusStackView.distribution = UIStackViewDistributionFill;
_statusStackView.alignment = UIStackViewAlignmentFill;
_statusStackView.spacing = 5;
}
return _statusStackView;
} }
@end @end

View File

@@ -19,13 +19,14 @@
///VC ///VC
#import "XPWebViewController.h" #import "XPWebViewController.h"
#import "XPRoomViewController.h" #import "XPRoomViewController.h"
#import "SessionViewController.h"
///Model ///Model
#import "HomeRecommendRoomModel.h" #import "HomeRecommendRoomModel.h"
///P ///P
#import "XPHomePresenter.h" #import "XPHomePresenter.h"
#import "XPHomeProtocol.h" #import "XPHomeProtocol.h"
@interface XPFindNewFriendViewController ()<UITableViewDelegate, UITableViewDataSource, XPHomeBannerTableViewCellDelegate, XPHomeProtocol> @interface XPFindNewFriendViewController ()<UITableViewDelegate, UITableViewDataSource, XPHomeBannerTableViewCellDelegate, XPHomeProtocol, XPFindNewFriendTableViewCellDelegate>
/// ///
@property (nonatomic,strong) UITableView *tableView; @property (nonatomic,strong) UITableView *tableView;
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView); @property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
@@ -110,6 +111,10 @@
}]; }];
} }
#pragma mark - XPFindNewFriendTableViewCellDelegate
#pragma mark - XPHomeProtocol #pragma mark - XPHomeProtocol
- (void)getHomeRecommendRoomListSuccess:(NSArray *)list state:(BOOL)state { - (void)getHomeRecommendRoomListSuccess:(NSArray *)list state:(BOOL)state {
if (state == 0) { if (state == 0) {
@@ -153,10 +158,8 @@
if (self.dataSource.count > 0) { if (self.dataSource.count > 0) {
HomeRecommendRoomModel * model = [self.dataSource safeObjectAtIndex1:indexPath.row]; HomeRecommendRoomModel * model = [self.dataSource safeObjectAtIndex1:indexPath.row];
XPFindNewFriendTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPFindNewFriendTableViewCell class])]; XPFindNewFriendTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPFindNewFriendTableViewCell class])];
if (cell == nil) {
cell = [[XPFindNewFriendTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPFindNewFriendTableViewCell class])];
}
cell.roomInfo = model; cell.roomInfo = model;
cell.delegate = self;
return cell; return cell;
} }
XPHomeListEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeListEmptyTableViewCell class])]; XPHomeListEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeListEmptyTableViewCell class])];
@@ -170,9 +173,15 @@
[tableView deselectRowAtIndexPath:indexPath animated:YES]; [tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.dataSource.count > 0) { if (self.dataSource.count > 0) {
HomeRecommendRoomModel * model = [self.dataSource safeObjectAtIndex1:indexPath.row]; HomeRecommendRoomModel * model = [self.dataSource safeObjectAtIndex1:indexPath.row];
if (model.uid.integerValue > 0) { if (model.roomUid.integerValue > 0) {
[XPRoomViewController openRoom:model.uid fromNick:model.title fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self]; [XPRoomViewController openRoom:model.uid fromNick:model.title fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self];
} }
///
// NSString * sessionId = [NSString stringWithFormat:@"%@",model.uid];
// NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
// SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
// [self.navigationController pushViewController:sessionVC animated:YES];
} }
} }

View File

@@ -16,6 +16,7 @@
#import "ThemeColor.h" #import "ThemeColor.h"
///View ///View
#import "XPPartyListCollectionViewCell.h" #import "XPPartyListCollectionViewCell.h"
#import "XPHomeListEmptyCollectionViewCell.h"
///P ///P
#import "XPHomePresenter.h" #import "XPHomePresenter.h"
#import "XPHomeProtocol.h" #import "XPHomeProtocol.h"
@@ -164,14 +165,18 @@
#pragma mark - UICollectionViewDelegate #pragma mark - UICollectionViewDelegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.dataSource.count; return self.dataSource.count > 0 ? self.dataSource.count : 1;
} }
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPPartyListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class]) forIndexPath:indexPath]; if (self.dataSource.count > 0) {
HomeRecommendRoomModel *model = [self.dataSource safeObjectAtIndex1:indexPath.row]; XPPartyListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class]) forIndexPath:indexPath];
cell.roomModel = model; HomeRecommendRoomModel *model = [self.dataSource safeObjectAtIndex1:indexPath.row];
return cell; cell.roomModel = model;
return cell;
}
XPHomeListEmptyCollectionViewCell * emptyCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeListEmptyCollectionViewCell class]) forIndexPath:indexPath];
return emptyCell;
} }
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
@@ -217,6 +222,7 @@
_collectionView.delegate = self; _collectionView.delegate = self;
_collectionView.dataSource = self; _collectionView.dataSource = self;
[_collectionView registerClass:[XPPartyListCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class])]; [_collectionView registerClass:[XPPartyListCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class])];
[_collectionView registerClass:[XPHomeListEmptyCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPHomeListEmptyCollectionViewCell class])];
} }
return _collectionView; return _collectionView;
} }

Binary file not shown.