新增自定义麦位布局和房间麦位选择视图,优化房间用户界面,更新本地化字符串,调整部分UI组件约束。版本号更新至20.20.65。
This commit is contained in:
@@ -550,6 +550,10 @@
|
||||
4CC312272D79A10100F57A07 /* ShareProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC312262D79A10100F57A07 /* ShareProvider.m */; };
|
||||
4CC6195A2CEC7770008C1EE8 /* MyDressingDataPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */; };
|
||||
4CC6195D2CEC996E008C1EE8 /* MyDressingDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */; };
|
||||
4CCA0C6E2DDED89F00E30513 /* Custom9MicLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C672DDED89F00E30513 /* Custom9MicLayout.m */; };
|
||||
4CCA0C6F2DDED89F00E30513 /* UserRoomMicPositionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C6D2DDED89F00E30513 /* UserRoomMicPositionView.m */; };
|
||||
4CCA0C702DDED89F00E30513 /* UserRoomMicPositionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C6B2DDED89F00E30513 /* UserRoomMicPositionCell.m */; };
|
||||
4CCA0C712DDED89F00E30513 /* Custom19MicLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C692DDED89F00E30513 /* Custom19MicLayout.m */; };
|
||||
4CCB809F2DD5DFDF00C756D3 /* EventRoomModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCB809E2DD5DFDF00C756D3 /* EventRoomModel.m */; };
|
||||
4CCFDA002DD59038009BD2FD /* EventCenterEmptyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCFD9FF2DD59038009BD2FD /* EventCenterEmptyCell.m */; };
|
||||
4CCFDA032DD59211009BD2FD /* Api+EventCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCFDA022DD59211009BD2FD /* Api+EventCenter.m */; };
|
||||
@@ -2750,6 +2754,14 @@
|
||||
4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataPresent.m; sourceTree = "<group>"; };
|
||||
4CC6195B2CEC996E008C1EE8 /* MyDressingDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyDressingDataModel.h; sourceTree = "<group>"; };
|
||||
4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataModel.m; sourceTree = "<group>"; };
|
||||
4CCA0C662DDED89F00E30513 /* Custom9MicLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Custom9MicLayout.h; sourceTree = "<group>"; };
|
||||
4CCA0C672DDED89F00E30513 /* Custom9MicLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Custom9MicLayout.m; sourceTree = "<group>"; };
|
||||
4CCA0C682DDED89F00E30513 /* Custom19MicLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Custom19MicLayout.h; sourceTree = "<group>"; };
|
||||
4CCA0C692DDED89F00E30513 /* Custom19MicLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Custom19MicLayout.m; sourceTree = "<group>"; };
|
||||
4CCA0C6A2DDED89F00E30513 /* UserRoomMicPositionCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserRoomMicPositionCell.h; sourceTree = "<group>"; };
|
||||
4CCA0C6B2DDED89F00E30513 /* UserRoomMicPositionCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserRoomMicPositionCell.m; sourceTree = "<group>"; };
|
||||
4CCA0C6C2DDED89F00E30513 /* UserRoomMicPositionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserRoomMicPositionView.h; sourceTree = "<group>"; };
|
||||
4CCA0C6D2DDED89F00E30513 /* UserRoomMicPositionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserRoomMicPositionView.m; sourceTree = "<group>"; };
|
||||
4CCB809D2DD5DFDF00C756D3 /* EventRoomModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EventRoomModel.h; sourceTree = "<group>"; };
|
||||
4CCB809E2DD5DFDF00C756D3 /* EventRoomModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EventRoomModel.m; sourceTree = "<group>"; };
|
||||
4CCFD9FE2DD59038009BD2FD /* EventCenterEmptyCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EventCenterEmptyCell.h; sourceTree = "<group>"; };
|
||||
@@ -8462,6 +8474,14 @@
|
||||
E82325ED274E2D8E003A3332 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4CCA0C662DDED89F00E30513 /* Custom9MicLayout.h */,
|
||||
4CCA0C672DDED89F00E30513 /* Custom9MicLayout.m */,
|
||||
4CCA0C682DDED89F00E30513 /* Custom19MicLayout.h */,
|
||||
4CCA0C692DDED89F00E30513 /* Custom19MicLayout.m */,
|
||||
4CCA0C6A2DDED89F00E30513 /* UserRoomMicPositionCell.h */,
|
||||
4CCA0C6B2DDED89F00E30513 /* UserRoomMicPositionCell.m */,
|
||||
4CCA0C6C2DDED89F00E30513 /* UserRoomMicPositionView.h */,
|
||||
4CCA0C6D2DDED89F00E30513 /* UserRoomMicPositionView.m */,
|
||||
9B85B6D4279FDAA900A0A1AC /* SubViews */,
|
||||
E82325FD274E48D0003A3332 /* Cell */,
|
||||
E82325F0274E2DE6003A3332 /* XPUserCardViewController.h */,
|
||||
@@ -12968,6 +12988,10 @@
|
||||
E81366E726F0A49E0076364C /* NSString+Utils.m in Sources */,
|
||||
23194DD22AD14BF000649F51 /* DDFileLogger.m in Sources */,
|
||||
E8EEB90126FC31B6007C6EBA /* XPMineUserInfoPresenter.m in Sources */,
|
||||
4CCA0C6E2DDED89F00E30513 /* Custom9MicLayout.m in Sources */,
|
||||
4CCA0C6F2DDED89F00E30513 /* UserRoomMicPositionView.m in Sources */,
|
||||
4CCA0C702DDED89F00E30513 /* UserRoomMicPositionCell.m in Sources */,
|
||||
4CCA0C712DDED89F00E30513 /* Custom19MicLayout.m in Sources */,
|
||||
4CE746D22D92A2660094E496 /* BravoGiftBannerView.m in Sources */,
|
||||
4C864A022D55F4F600191AE0 /* LuckyPackagePresenter.m in Sources */,
|
||||
E81A65312834E53600F55894 /* XPMomentsLatestViewController.m in Sources */,
|
||||
|
21
YuMi/Assets.xcassets/20.20.59/event_review.imageset/Contents.json
vendored
Normal file
21
YuMi/Assets.xcassets/20.20.59/event_review.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "容器@3x (3).png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/20.20.59/event_review.imageset/容器@3x (3).png
vendored
Normal file
BIN
YuMi/Assets.xcassets/20.20.59/event_review.imageset/容器@3x (3).png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 774 B |
21
YuMi/Assets.xcassets/20.20.59/event_staring.imageset/Contents.json
vendored
Normal file
21
YuMi/Assets.xcassets/20.20.59/event_staring.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "容器@3x (4).png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/20.20.59/event_staring.imageset/容器@3x (4).png
vendored
Normal file
BIN
YuMi/Assets.xcassets/20.20.59/event_staring.imageset/容器@3x (4).png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@@ -11,7 +11,7 @@
|
||||
#import "YuMi-swift.h"
|
||||
#import "RechargeStorage.h"
|
||||
|
||||
#define MAX_RETRY_COUNT 10
|
||||
#define MAX_RETRY_COUNT 50
|
||||
|
||||
@interface IAPManager()
|
||||
|
||||
|
@@ -32,9 +32,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) NSInteger roomUid; // 房间用户ID
|
||||
@property (nonatomic, assign) NSTimeInterval eventStartTime;// 事件开始时间戳
|
||||
@property (nonatomic, assign) NSTimeInterval createTime; // 创建时间戳
|
||||
|
||||
@property (nonatomic, copy) NSString *avatar;
|
||||
@property (nonatomic, assign) NSInteger gender;
|
||||
@property (nonatomic, copy) NSString *nick;
|
||||
@property (nonatomic, copy) NSString *erbanNo;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -17,11 +17,14 @@
|
||||
// Maybe 用一个方法 + 枚举指来指代一个功能类型的 api call?
|
||||
|
||||
- (void)loadConfig {
|
||||
@kWeakify(self);
|
||||
[Api usereventGoldConfig:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(loadCongfigSuccess:)]) {
|
||||
[[self getView] loadCongfigSuccess:[EventConfigModel modelWithJSON:data.data]];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(loadCongfigFailure:)]) {
|
||||
[[self getView] loadCongfigFailure:msg];
|
||||
}
|
||||
@@ -30,11 +33,14 @@
|
||||
}
|
||||
|
||||
- (void)loadOfficialEvents {
|
||||
@kWeakify(self);
|
||||
[Api homeBanner:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(officialEventListSuccess:)]) {
|
||||
[[self getView] officialEventListSuccess:[HomeBannerInfoModel modelsWithArray:data.data]];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(officialEventListFailure:)]) {
|
||||
[[self getView] officialEventListFailure:msg];
|
||||
}
|
||||
@@ -42,11 +48,14 @@
|
||||
}
|
||||
|
||||
- (void)loadEventSquare:(NSInteger)page {
|
||||
@kWeakify(self);
|
||||
[Api usereventSquare:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(eventSquareListSuccess:)]) {
|
||||
[[self getView] eventSquareListSuccess:[EventItemModel modelsWithArray:data.data]];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(eventSquareListFailure:)]) {
|
||||
[[self getView] eventSquareListFailure:msg];
|
||||
}
|
||||
@@ -54,11 +63,14 @@
|
||||
}
|
||||
|
||||
- (void)loadMyCreateEvents:(NSInteger)page {
|
||||
@kWeakify(self);
|
||||
[Api usereventMySquare:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(myCreateEventListSuccess:)]) {
|
||||
[[self getView] myCreateEventListSuccess:[EventItemModel modelsWithArray:data.data]];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(myCreateEventListFailure:)]) {
|
||||
[[self getView] myCreateEventListFailure:msg];
|
||||
}
|
||||
@@ -69,11 +81,14 @@
|
||||
}
|
||||
|
||||
- (void)loadMySubEvents:(NSInteger)page {
|
||||
@kWeakify(self);
|
||||
[Api usereventMySub:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(mySubEventListSuccess:)]) {
|
||||
[[self getView] mySubEventListSuccess:[EventItemModel modelsWithArray:data.data]];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(mySubEventListFailure:)]) {
|
||||
[[self getView] mySubEventListFailure:msg];
|
||||
}
|
||||
@@ -97,11 +112,12 @@
|
||||
if ([[self getView] respondsToSelector:@selector(mySubEventListSuccess:)]) {
|
||||
[[self getView] mySubEventListSuccess:subs];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}] subscribeError:^(NSError * _Nullable error) {
|
||||
@kStrongify(self);
|
||||
[[self getView] myEventListFailure:error.domain];
|
||||
if ([[self getView] respondsToSelector:@selector(myEventListFailure:)]) {
|
||||
[[self getView] myEventListFailure:error.domain];
|
||||
}
|
||||
}];
|
||||
|
||||
[Api usereventMySquare:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@@ -134,11 +150,14 @@
|
||||
}
|
||||
|
||||
- (void)loadMyRooms {
|
||||
@kWeakify(self);
|
||||
[Api roomRoleListRoom:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(myRoomListSuccess:)]) {
|
||||
[[self getView] myRoomListSuccess:[EventRoomListModel modelWithJSON:data.data]];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(myRoomListFailure:)]) {
|
||||
[[self getView] myRoomListFailure:msg];
|
||||
}
|
||||
@@ -146,11 +165,14 @@
|
||||
}
|
||||
|
||||
- (void)deleteEvent:(NSInteger)eventId {
|
||||
@kWeakify(self);
|
||||
[Api usereventDel:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(deleteEventSuccess:)]) {
|
||||
[[self getView] deleteEventSuccess:eventId];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(deleteEventFailure:)]) {
|
||||
[[self getView] deleteEventFailure:msg];
|
||||
}
|
||||
@@ -159,11 +181,14 @@
|
||||
|
||||
- (void)subEvent:(BOOL)isSub
|
||||
eventId:(NSInteger)eventId {
|
||||
@kWeakify(self);
|
||||
[Api usereventSub:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(eventSubActionSuccess: eventId:)]) {
|
||||
[[self getView] eventSubActionSuccess:isSub eventId:eventId];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(eventSubActionFailure:)]) {
|
||||
[[self getView] eventSubActionFailure:msg];
|
||||
}
|
||||
@@ -183,11 +208,14 @@
|
||||
roomUid:(NSInteger)roomUid
|
||||
notifyFans:(BOOL)notifyFans {
|
||||
|
||||
@kWeakify(self);
|
||||
[Api usereventPublish:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(createEventSuccess)]) {
|
||||
[[self getView] createEventSuccess];
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if ([[self getView] respondsToSelector:@selector(createEventFailure:)]) {
|
||||
[[self getView] createEventFailure:msg];
|
||||
}
|
||||
@@ -208,9 +236,7 @@
|
||||
failure:(void(^)(NSError *error))failure {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
@kWeakify(self);
|
||||
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if (data.code == 200) {
|
||||
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
|
||||
if (success) {
|
||||
|
@@ -156,9 +156,9 @@
|
||||
- (void)updateCell:(EventItemModel *)model {
|
||||
_model = model;
|
||||
self.bgImageView.imageUrl = model.eventBanner;
|
||||
self.avatarImageView.imageUrl = model.roomAvatar;
|
||||
self.avatarImageView.imageUrl = model.avatar;
|
||||
self.nameLabel.text = model.nick;
|
||||
self.idLabel.text = [NSString stringWithFormat:@"ID:%@", @(model.roomErbanNo)];
|
||||
self.idLabel.text = [NSString stringWithFormat:@"ID:%@", model.erbanNo];
|
||||
self.eventDescLabel.text = model.eventTopic;
|
||||
self.subLabel.text = @(model.subNum).stringValue;
|
||||
self.sexImageView.image = model.gender == 1 ? kImage(@"common_male") : kImage(@"common_female");
|
||||
@@ -175,10 +175,12 @@
|
||||
case 0:
|
||||
needUpdateStatus = NO;
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_30");
|
||||
self.clockImageView.image = kImage(@"event_review");
|
||||
break;
|
||||
case 2:
|
||||
needUpdateStatus = NO;
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_31");
|
||||
self.clockImageView.image = kImage(@"event_review");
|
||||
break;
|
||||
case 4:
|
||||
needUpdateStatus = NO;
|
||||
@@ -190,7 +192,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
self.timeLabel.textColor = [UIColor colorWithWhite:1 alpha:0.6 ];
|
||||
|
||||
if (needUpdateStatus) {
|
||||
self.clockImageView.image = kImage(@"event_clock");
|
||||
switch (self.model.liveStatus) {
|
||||
case 1:
|
||||
self.timeLabel.text = [NSString stringWithFormat:@"%@:%@",
|
||||
@@ -199,6 +204,8 @@
|
||||
break;
|
||||
case 2:
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_24");
|
||||
self.timeLabel.textColor = UIColorFromRGB(0xff8c03);
|
||||
self.clockImageView.image = kImage(@"event_staring");
|
||||
break;
|
||||
case 3:
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_25");
|
||||
@@ -214,12 +221,15 @@
|
||||
if (self.model.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
switch (self.model.eventStatus) {
|
||||
case 0:
|
||||
needUpdateStatus = NO;
|
||||
self.statusButton.hidden = YES;
|
||||
self.deleteButton.hidden = YES;
|
||||
break;
|
||||
case 2:
|
||||
case 4:
|
||||
needUpdateStatus = NO;
|
||||
self.statusButton.hidden = YES;
|
||||
self.deleteButton.hidden = NO;
|
||||
// [self statusButtonUpdateToDelete];
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -228,6 +238,8 @@
|
||||
}
|
||||
|
||||
if (needUpdateStatus) {
|
||||
self.statusButton.alpha = 1;
|
||||
self.statusButton.enabled = YES;
|
||||
self.statusButton.hidden = NO;
|
||||
self.deleteButton.hidden = YES;
|
||||
switch (self.model.liveStatus) {
|
||||
@@ -242,6 +254,8 @@
|
||||
[self statusButtonUpdateToPatricipate];
|
||||
break;
|
||||
case 3:
|
||||
self.statusButton.alpha = 0.6;
|
||||
self.statusButton.enabled = NO;
|
||||
if (self.model.subStatus) {
|
||||
[self statusButtonUpdateToUnSub];
|
||||
} else {
|
||||
@@ -282,17 +296,6 @@
|
||||
[self resetStatusButtonInsets];
|
||||
}
|
||||
|
||||
- (void)statusButtonUpdateToDelete {
|
||||
self.action = EventCellAction_delete;
|
||||
[self.statusButton setImage:kImage(@"event_delete") forState:UIControlStateNormal];
|
||||
[self.statusButton setTitle:@"" forState:UIControlStateNormal];
|
||||
|
||||
// 重置insets,解决图片压缩问题
|
||||
self.statusButton.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
self.statusButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
self.statusButton.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
// 添加重置按钮内边距的方法
|
||||
- (void)resetStatusButtonInsets {
|
||||
CGFloat imageTitleSpacing = 4.0;
|
||||
|
@@ -252,7 +252,7 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
label.textColor = UIColorFromRGB(0x7b7b7d);
|
||||
[view addSubview:label];
|
||||
|
||||
UIImageView *arrowImageView = [[UIImageView alloc] initWithImage:kImage(@"event_arrow")];
|
||||
UIImageView *arrowImageView = [[UIImageView alloc] initWithImage:[kImage(@"event_arrow") ms_SetImageForRTL]];
|
||||
[view addSubview:arrowImageView];
|
||||
|
||||
[label mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -297,7 +297,12 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
// 使用TZImagePickerController来选择并裁剪图片
|
||||
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self];
|
||||
imagePickerVc.allowCrop = YES;
|
||||
imagePickerVc.maxImagesCount = 1;
|
||||
|
||||
// 允许拍照
|
||||
imagePickerVc.allowTakePicture = NO;
|
||||
imagePickerVc.allowPickingVideo = NO; // 不允许选择视频
|
||||
imagePickerVc.showSelectedIndex = YES;
|
||||
// 调整裁剪比例为 690:236
|
||||
CGFloat aspectRatio = 690.0 / 236.0; // 约为2.92:1
|
||||
|
||||
@@ -308,6 +313,10 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
// 设置裁剪框的尺寸
|
||||
imagePickerVc.cropRect = CGRectMake((KScreenWidth-cropWidth)/2, (KScreenHeight - cropHeight) / 2, cropWidth, cropHeight);
|
||||
|
||||
// 拍照裁剪设置
|
||||
// imagePickerVc.needCircleCrop = NO; // 不需要圆形裁剪
|
||||
// imagePickerVc.circleCropRadius = 0; // 圆形裁剪半径,不需要设置
|
||||
|
||||
[self presentViewController:imagePickerVc animated:YES completion:nil];
|
||||
} else {
|
||||
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
|
||||
@@ -326,7 +335,7 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
[vc setDidSelectedRoom:^(EventRoomModel * _Nonnull roomModel) {
|
||||
@kStrongify(self);
|
||||
self.selectRoomModel = roomModel;
|
||||
self.selectRoomPlaceholderLabel.text = roomModel.roomName;
|
||||
self.selectRoomPlaceholderLabel.text = @(roomModel.erbanNo).stringValue;
|
||||
self.selectRoomPlaceholderLabel.textColor = [UIColor blackColor];
|
||||
[self checkCreateEventButtonState];
|
||||
}];
|
||||
@@ -475,22 +484,6 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
if (!self.uploadBannerYesButton.selected) {
|
||||
self.uploadBannerYesButton.selected = YES;
|
||||
self.uploadBannerNoButton.selected = NO;
|
||||
// if (!self.walletInfoModel) {
|
||||
// [XNDJTDDLoadingTool showLoading];
|
||||
// @kWeakify(self);
|
||||
// [self.presenter loadMoney:^(WalletInfoModel * walletModel) {
|
||||
// @kStrongify(self);
|
||||
// self.walletInfoModel = walletModel;
|
||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// [XNDJTDDLoadingTool hideHUD];
|
||||
// [self checkWalletToUploadBanner];
|
||||
// });
|
||||
// } failure:^(NSError * _Nonnull error) {
|
||||
// [XNDJTDDLoadingTool showErrorWithMessage:error.domain];
|
||||
// }];
|
||||
// } else {
|
||||
// [self checkWalletToUploadBanner];
|
||||
// }
|
||||
}
|
||||
} else if (sender == self.uploadBannerNoButton) {
|
||||
if (!self.uploadBannerNoButton.selected) { // 避免重复设置
|
||||
@@ -640,13 +633,13 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
make.top.equalTo(self.uploadBannerLabel.mas_bottom).offset(kVerticalPadding);
|
||||
make.leading.equalTo(self.contentView).offset(kHorizontalPadding);
|
||||
make.height.mas_equalTo(20);
|
||||
make.width.mas_greaterThanOrEqualTo(60);
|
||||
make.width.mas_greaterThanOrEqualTo(80);
|
||||
}];
|
||||
[self.uploadBannerNoButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.uploadBannerLabel.mas_bottom).offset(kVerticalPadding);
|
||||
make.leading.equalTo(self.uploadBannerYesButton.mas_trailing).offset(70);
|
||||
make.height.equalTo(self.uploadBannerYesButton);
|
||||
make.width.mas_greaterThanOrEqualTo(60);
|
||||
make.width.mas_greaterThanOrEqualTo(80);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -792,4 +785,28 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加拍照结果的处理方法
|
||||
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(PHAsset *)asset {
|
||||
// 不处理视频
|
||||
}
|
||||
|
||||
// 处理用户拍照的情况
|
||||
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingImage:(UIImage *)image {
|
||||
// 直接使用拍照的图片
|
||||
self.selectedImage = image;
|
||||
self.eventBannerImageView.image = image;
|
||||
self.eventBannerCamearImageView.hidden = NO;
|
||||
[self checkCreateEventButtonState];
|
||||
}
|
||||
|
||||
// 处理拍照或摄像完成的回调
|
||||
- (void)imagePickerController:(TZImagePickerController *)picker didFinishTakePhoto:(UIImage *)image sourceType:(TZAssetModelMediaType)sourceType cutImage:(UIImage *)cutImage isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto {
|
||||
// 优先使用裁剪后的图片,如果有的话
|
||||
UIImage *finalImage = cutImage ? cutImage : image;
|
||||
self.selectedImage = finalImage;
|
||||
self.eventBannerImageView.image = finalImage;
|
||||
self.eventBannerCamearImageView.hidden = NO;
|
||||
[self checkCreateEventButtonState];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -103,7 +103,7 @@ static UIEdgeInsets kOfficialTableViewContentInset(void) {
|
||||
[self.tabView addSubview:button];
|
||||
[button mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(self.tabView);
|
||||
make.left.equalTo(self.tabView).offset(i * buttonWidth);
|
||||
make.leading.equalTo(self.tabView).offset(i * buttonWidth);
|
||||
make.width.mas_equalTo(buttonWidth);
|
||||
}];
|
||||
[buttons addObject:button];
|
||||
@@ -181,12 +181,6 @@ static UIEdgeInsets kOfficialTableViewContentInset(void) {
|
||||
#pragma mark - Setup Data
|
||||
- (void)setOfficialDatasource:(NSMutableArray<HomeBannerInfoModel *> *)officialDatasource {
|
||||
_officialDatasource = officialDatasource;
|
||||
//#if DEBUG
|
||||
//#else
|
||||
// NSPredicate *predicate = [NSPredicate predicateWithFormat:@"activityShow == %@", @(1)];
|
||||
// [_officialDatasource filterUsingPredicate:predicate];
|
||||
//#endif
|
||||
|
||||
// 处理空数据状态
|
||||
if (_officialDatasource.count == 0) {
|
||||
self.officialTableView.mj_header.hidden = NO;
|
||||
@@ -553,13 +547,6 @@ static UIEdgeInsets kOfficialTableViewContentInset(void) {
|
||||
NSInteger index = [self.contentViewControllers indexOfObject:pageViewController.viewControllers.firstObject];
|
||||
if (index != NSNotFound) {
|
||||
[self switchToIndex:index animated:YES];
|
||||
|
||||
// 首次切换到活动广场,加载数据
|
||||
if (index == 1 && self.eventSquareDatasource.count == 0) {
|
||||
[self.presenter loadEventSquare:self.eventSquareTableViewPage];
|
||||
} else if (index == 2 && self.myCreateEventDatasource == 0 && self.mySubEventDatasource == 0) {
|
||||
[self.presenter loadMyEvents];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,6 +628,13 @@ static UIEdgeInsets kOfficialTableViewContentInset(void) {
|
||||
[self.myEventTableView.mj_footer setHidden:YES];
|
||||
}
|
||||
|
||||
- (void)myEventListFailure:(NSString *)msg {
|
||||
[self.myEventTableView.mj_header endRefreshing];
|
||||
if (self.myEventTableViewPage == 1) {
|
||||
[self.myEventTableView.mj_footer setHidden:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)eventSubActionSuccess:(BOOL)isSub eventId:(NSInteger)eventId {
|
||||
NSInteger count = 0;
|
||||
if (isSub) {
|
||||
|
@@ -125,7 +125,10 @@
|
||||
}
|
||||
|
||||
- (void)myCreateEventListFailure:(NSString *)msg {
|
||||
|
||||
[self.myEventTableView.mj_header endRefreshing];
|
||||
if (self.page > 1) {
|
||||
[self.myEventTableView.mj_footer endRefreshing];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)eventSubActionSuccess:(BOOL)isSub eventId:(NSInteger)eventId {
|
||||
|
@@ -79,8 +79,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param roomUid 房间id
|
||||
-(void)getKickUserListWithRoomUid:(NSString *)roomUid;
|
||||
|
||||
|
||||
// TODO: 转移到 Manager 管理逻辑
|
||||
- (void)getBoomRocketAnimationInfo:(NSString *)roomUid;
|
||||
|
||||
- (void)getBoomDetail:(NSString *)roomUid;
|
||||
|
@@ -45,6 +45,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
|
||||
|
||||
///输入框
|
||||
@property (nonatomic,strong) UIButton *inputButton;
|
||||
@property (nonatomic,strong) UILabel *inputLabel;
|
||||
///麦
|
||||
@property (nonatomic,strong) UIButton *micButton;
|
||||
@property (nonatomic,strong) UIButton *micButton_open;
|
||||
@@ -399,7 +400,8 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
|
||||
[self.stackView addArrangedSubview:self.moreButton];
|
||||
[self.stackView addArrangedSubview:self.giftButton];
|
||||
|
||||
[self.stackView addSubview:self.faceButton];
|
||||
[self.stackView addSubview:self.inputLabel];
|
||||
[self.stackView addSubview:self.faceButton];
|
||||
|
||||
[self.stackView addSubview:self.micButton_open];
|
||||
[self.stackView addSubview:self.micButton_close_all];
|
||||
@@ -434,11 +436,17 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
|
||||
}];
|
||||
|
||||
[self.faceButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.inputButton);
|
||||
make.trailing.mas_equalTo(self.inputButton).offset(-4);
|
||||
make.centerY.mas_equalTo(self.inputButton);
|
||||
make.trailing.mas_equalTo(self.inputButton).offset(-4);
|
||||
make.width.height.mas_equalTo(36);
|
||||
}];
|
||||
|
||||
[self.inputLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.inputButton);
|
||||
make.leading.mas_equalTo(self.inputButton).offset(8);
|
||||
make.trailing.mas_equalTo(self.faceButton.mas_leading).offset(-4);
|
||||
}];
|
||||
|
||||
[self.micButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(36);
|
||||
}];
|
||||
@@ -730,10 +738,10 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
|
||||
- (UIButton *)inputButton {
|
||||
if (!_inputButton) {
|
||||
_inputButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_inputButton setTitle:YMLocalizedString(@"XPRoomMenuContainerView2") forState:UIControlStateNormal];
|
||||
[_inputButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_inputButton.titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
|
||||
_inputButton.titleLabel.numberOfLines = 2;
|
||||
// [_inputButton setTitle:YMLocalizedString(@"XPRoomMenuContainerView2") forState:UIControlStateNormal];
|
||||
// [_inputButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
// _inputButton.titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
|
||||
// _inputButton.titleLabel.numberOfLines = 2;
|
||||
_inputButton.layer.masksToBounds = YES;
|
||||
_inputButton.layer.cornerRadius = 18;
|
||||
if (isMSRTL()) {
|
||||
@@ -750,6 +758,18 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
|
||||
return _inputButton;
|
||||
}
|
||||
|
||||
- (UILabel *)inputLabel {
|
||||
if (!_inputLabel) {
|
||||
_inputLabel = [UILabel labelInitWithText:YMLocalizedString(@"XPRoomMenuContainerView2")
|
||||
font:kFontMedium(13)
|
||||
textColor:[UIColor whiteColor]];
|
||||
_inputLabel.adjustsFontSizeToFitWidth = YES;
|
||||
_inputLabel.minimumScaleFactor = 0.7;
|
||||
_inputLabel.numberOfLines = 2;
|
||||
}
|
||||
return _inputLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)micButton {
|
||||
if (!_micButton) {
|
||||
_micButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
|
@@ -42,11 +42,6 @@ static NSString *MessageCellID = @"MessageCell";
|
||||
return self;
|
||||
}
|
||||
|
||||
//TODO:
|
||||
//修改 messageInfo 的组装流程,获取到消息后,先放入处理队列-1。
|
||||
// 队列-1 会按顺序处理消息,并预下载图片,所有图片下载完成后,用 cache 图片生成富文本,并放入队列-2
|
||||
// 队列-2 会按顺序计算富文本的 size,并插入到需要显示的消息队列中,并将 size 传递到外部
|
||||
|
||||
#pragma mark - 配置数据
|
||||
- (void)setMessageInfo:(XPMessageInfoModel *)messageInfo {
|
||||
_messageInfo = messageInfo;
|
||||
|
@@ -109,9 +109,6 @@
|
||||
self.remainingTime -= 0.1;
|
||||
|
||||
if (self.remainingTime <= 0) {
|
||||
|
||||
// TODO: 这里的timer 只负责动画,manager 处增加处理逻辑的 timer
|
||||
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
|
||||
|
19
YuMi/Modules/YMRoom/View/UserCard/View/Custom19MicLayout.h
Normal file
19
YuMi/Modules/YMRoom/View/UserCard/View/Custom19MicLayout.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Custom19MicLayout.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/12/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 19麦位自定义布局
|
||||
@interface Custom19MicLayout : UICollectionViewLayout
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray<UICollectionViewLayoutAttributes *> *attributesArray;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
77
YuMi/Modules/YMRoom/View/UserCard/View/Custom19MicLayout.m
Normal file
77
YuMi/Modules/YMRoom/View/UserCard/View/Custom19MicLayout.m
Normal file
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// Custom19MicLayout.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/12/11.
|
||||
//
|
||||
|
||||
#import "Custom19MicLayout.h"
|
||||
|
||||
@implementation Custom19MicLayout
|
||||
|
||||
- (void)prepareLayout {
|
||||
[super prepareLayout];
|
||||
|
||||
self.attributesArray = [NSMutableArray array];
|
||||
|
||||
CGFloat collectionWidth = self.collectionView.bounds.size.width;
|
||||
CGFloat itemWidth = 50.0; // 每个 item 的宽度
|
||||
CGFloat itemHeight = 50.0 + 4 + 17; // 每个 item 的高度
|
||||
CGFloat spacing = 20.0; // 每个 item 之间的水平间距
|
||||
CGFloat rowSpacing = 20.0; // 每行之间的垂直间距
|
||||
CGFloat yOffset = 0;
|
||||
|
||||
// 预定义每行的元素布局规则
|
||||
NSArray<NSArray<NSNumber *> *> *layoutRows = @[
|
||||
@[@1, @1, @1, @1, @1], // 第 1 行: 居中排列 5 个元素
|
||||
@[@1, @1, @1, @1, @1], // 第 2 行: 两边元素对称排列
|
||||
// @[@0, @0, @1], // 第 3 行: 居中 1 个元素
|
||||
@[@1, @1, @0, @1, @1], // 第 4 行: 两边对称排列
|
||||
@[@1, @1, @1, @1, @1] // 第 5 行: 居中排列 5 个元素
|
||||
];
|
||||
|
||||
NSInteger itemIndex = 0; // 当前 item 索引
|
||||
|
||||
for (NSArray<NSNumber *> *row in layoutRows) {
|
||||
// 计算当前行的总宽度
|
||||
NSInteger itemCount = row.count;
|
||||
CGFloat totalItemWidth = itemCount * itemWidth + (itemCount - 1) * spacing;
|
||||
|
||||
// 计算行的 xOffset 让内容整体居中
|
||||
CGFloat xOffset = (collectionWidth - totalItemWidth) / 2.0;
|
||||
|
||||
for (NSNumber *isItem in row) {
|
||||
if ([isItem boolValue]) { // 如果该位置有 item
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:itemIndex inSection:0];
|
||||
UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
|
||||
if (itemIndex == 7) {
|
||||
// 中央特殊处理
|
||||
attributes.frame = CGRectMake(xOffset-(itemWidth * 0.1), yOffset+itemWidth*2/3, itemWidth*1.2, itemHeight*1.2);
|
||||
[self.attributesArray addObject:attributes];
|
||||
} else {
|
||||
// 设置每个 item 的位置
|
||||
attributes.frame = CGRectMake(xOffset, yOffset, itemWidth, itemHeight);
|
||||
[self.attributesArray addObject:attributes];
|
||||
}
|
||||
// 更新 item 索引
|
||||
itemIndex++;
|
||||
}
|
||||
|
||||
// 更新 xOffset,无论是否有 item 都需要移动
|
||||
xOffset += itemWidth + spacing;
|
||||
}
|
||||
|
||||
// 每一行的 yOffset 往下移动
|
||||
yOffset += itemHeight + rowSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
|
||||
return self.attributesArray;
|
||||
}
|
||||
|
||||
- (CGSize)collectionViewContentSize {
|
||||
return CGSizeMake(self.collectionView.bounds.size.width, 400); // 设置总内容高度
|
||||
}
|
||||
|
||||
@end
|
19
YuMi/Modules/YMRoom/View/UserCard/View/Custom9MicLayout.h
Normal file
19
YuMi/Modules/YMRoom/View/UserCard/View/Custom9MicLayout.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Custom9MicLayout.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/12/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 9麦位自定义布局
|
||||
@interface Custom9MicLayout : UICollectionViewLayout
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray<UICollectionViewLayoutAttributes *> *attributesArray;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
59
YuMi/Modules/YMRoom/View/UserCard/View/Custom9MicLayout.m
Normal file
59
YuMi/Modules/YMRoom/View/UserCard/View/Custom9MicLayout.m
Normal file
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// Custom9MicLayout.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/12/11.
|
||||
//
|
||||
|
||||
#import "Custom9MicLayout.h"
|
||||
|
||||
@implementation Custom9MicLayout
|
||||
|
||||
- (void)prepareLayout {
|
||||
[super prepareLayout];
|
||||
|
||||
self.attributesArray = [NSMutableArray array];
|
||||
|
||||
NSInteger sectionCount = [self.collectionView numberOfSections];
|
||||
CGFloat collectionWidth = self.collectionView.bounds.size.width;
|
||||
CGFloat itemWidth = 50.0; // 每个 item 的宽度
|
||||
CGFloat itemHeight = 50.0 + 4 + 17; // 每个 item 的高度
|
||||
CGFloat spacing = 48.0; // 每个 item 之间的间距
|
||||
|
||||
CGFloat yOffset = 0;
|
||||
|
||||
for (NSInteger section = 0; section < sectionCount; section++) {
|
||||
NSInteger itemCount = [self.collectionView numberOfItemsInSection:section];
|
||||
|
||||
// 计算当前行的总宽度 = 所有 items 宽度 + 间距
|
||||
CGFloat totalItemWidth = itemCount * itemWidth + (itemCount - 1) * spacing;
|
||||
|
||||
// 计算这一行的起始 xOffset,让内容整体居中
|
||||
CGFloat xOffset = (collectionWidth - totalItemWidth) / 2.0;
|
||||
|
||||
for (NSInteger item = 0; item < itemCount; item++) {
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];
|
||||
UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
|
||||
|
||||
// 设置每个 item 的位置
|
||||
attributes.frame = CGRectMake(xOffset, yOffset, itemWidth, itemHeight);
|
||||
[self.attributesArray addObject:attributes];
|
||||
|
||||
// 更新 xOffset,给下一个 item 使用
|
||||
xOffset += itemWidth + spacing;
|
||||
}
|
||||
|
||||
// 每一行的 yOffset 往下移动
|
||||
yOffset += itemHeight + 20; // 每行之间的间距为 20
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
|
||||
return self.attributesArray;
|
||||
}
|
||||
|
||||
- (CGSize)collectionViewContentSize {
|
||||
return CGSizeMake(self.collectionView.bounds.size.width, 400); // 设置总内容高度
|
||||
}
|
||||
|
||||
@end
|
@@ -29,380 +29,10 @@
|
||||
#import "SuperBlockViewController.h"
|
||||
#import "XPSkillCardPlayerManager.h"
|
||||
|
||||
@interface Custom19MicLayout : UICollectionViewLayout
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray<UICollectionViewLayoutAttributes *> *attributesArray;
|
||||
|
||||
@end
|
||||
|
||||
@implementation Custom19MicLayout
|
||||
|
||||
- (void)prepareLayout {
|
||||
[super prepareLayout];
|
||||
|
||||
self.attributesArray = [NSMutableArray array];
|
||||
|
||||
CGFloat collectionWidth = self.collectionView.bounds.size.width;
|
||||
CGFloat itemWidth = 50.0; // 每个 item 的宽度
|
||||
CGFloat itemHeight = 50.0 + 4 + 17; // 每个 item 的高度
|
||||
CGFloat spacing = 20.0; // 每个 item 之间的水平间距
|
||||
CGFloat rowSpacing = 20.0; // 每行之间的垂直间距
|
||||
CGFloat yOffset = 0;
|
||||
|
||||
// 预定义每行的元素布局规则
|
||||
NSArray<NSArray<NSNumber *> *> *layoutRows = @[
|
||||
@[@1, @1, @1, @1, @1], // 第 1 行: 居中排列 5 个元素
|
||||
@[@1, @1, @1, @1, @1], // 第 2 行: 两边元素对称排列
|
||||
// @[@0, @0, @1], // 第 3 行: 居中 1 个元素
|
||||
@[@1, @1, @0, @1, @1], // 第 4 行: 两边对称排列
|
||||
@[@1, @1, @1, @1, @1] // 第 5 行: 居中排列 5 个元素
|
||||
];
|
||||
|
||||
NSInteger itemIndex = 0; // 当前 item 索引
|
||||
|
||||
for (NSArray<NSNumber *> *row in layoutRows) {
|
||||
// 计算当前行的总宽度
|
||||
NSInteger itemCount = row.count;
|
||||
CGFloat totalItemWidth = itemCount * itemWidth + (itemCount - 1) * spacing;
|
||||
|
||||
// 计算行的 xOffset 让内容整体居中
|
||||
CGFloat xOffset = (collectionWidth - totalItemWidth) / 2.0;
|
||||
|
||||
for (NSNumber *isItem in row) {
|
||||
if ([isItem boolValue]) { // 如果该位置有 item
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:itemIndex inSection:0];
|
||||
UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
|
||||
if (itemIndex == 7) {
|
||||
// 中央特殊处理
|
||||
attributes.frame = CGRectMake(xOffset-(itemWidth * 0.1), yOffset+itemWidth*2/3, itemWidth*1.2, itemHeight*1.2);
|
||||
[self.attributesArray addObject:attributes];
|
||||
} else {
|
||||
// 设置每个 item 的位置
|
||||
attributes.frame = CGRectMake(xOffset, yOffset, itemWidth, itemHeight);
|
||||
[self.attributesArray addObject:attributes];
|
||||
}
|
||||
// 更新 item 索引
|
||||
itemIndex++;
|
||||
}
|
||||
|
||||
// 更新 xOffset,无论是否有 item 都需要移动
|
||||
xOffset += itemWidth + spacing;
|
||||
}
|
||||
|
||||
// 每一行的 yOffset 往下移动
|
||||
yOffset += itemHeight + rowSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
|
||||
return self.attributesArray;
|
||||
}
|
||||
|
||||
- (CGSize)collectionViewContentSize {
|
||||
return CGSizeMake(self.collectionView.bounds.size.width, 400); // 设置总内容高度
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface Custom9MicLayout : UICollectionViewLayout
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray<UICollectionViewLayoutAttributes *> *attributesArray;
|
||||
|
||||
@end
|
||||
|
||||
@implementation Custom9MicLayout
|
||||
|
||||
- (void)prepareLayout {
|
||||
[super prepareLayout];
|
||||
|
||||
self.attributesArray = [NSMutableArray array];
|
||||
|
||||
NSInteger sectionCount = [self.collectionView numberOfSections];
|
||||
CGFloat collectionWidth = self.collectionView.bounds.size.width;
|
||||
CGFloat itemWidth = 50.0; // 每个 item 的宽度
|
||||
CGFloat itemHeight = 50.0 + 4 + 17; // 每个 item 的高度
|
||||
CGFloat spacing = 48.0; // 每个 item 之间的间距
|
||||
|
||||
// CGFloat xOffset = 0;
|
||||
CGFloat yOffset = 0;
|
||||
|
||||
for (NSInteger section = 0; section < sectionCount; section++) {
|
||||
NSInteger itemCount = [self.collectionView numberOfItemsInSection:section];
|
||||
|
||||
// 计算当前行的总宽度 = 所有 items 宽度 + 间距
|
||||
CGFloat totalItemWidth = itemCount * itemWidth + (itemCount - 1) * spacing;
|
||||
|
||||
// 计算这一行的起始 xOffset,让内容整体居中
|
||||
CGFloat xOffset = (collectionWidth - totalItemWidth) / 2.0;
|
||||
|
||||
for (NSInteger item = 0; item < itemCount; item++) {
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];
|
||||
UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
|
||||
|
||||
// 设置每个 item 的位置
|
||||
attributes.frame = CGRectMake(xOffset, yOffset, itemWidth, itemHeight);
|
||||
[self.attributesArray addObject:attributes];
|
||||
|
||||
// 更新 xOffset,给下一个 item 使用
|
||||
xOffset += itemWidth + spacing;
|
||||
}
|
||||
|
||||
// 每一行的 yOffset 往下移动
|
||||
yOffset += itemHeight + 20; // 每行之间的间距为 20
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
|
||||
return self.attributesArray;
|
||||
}
|
||||
|
||||
- (CGSize)collectionViewContentSize {
|
||||
return CGSizeMake(self.collectionView.bounds.size.width, 400); // 设置总内容高度
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface UserRoomMicPositionCell : UICollectionViewCell
|
||||
|
||||
@property(nonatomic, strong) UIImageView *iconImageView;
|
||||
@property(nonatomic, strong) UILabel *contentLabel;
|
||||
@property(nonatomic, assign) BOOL isUsed;
|
||||
@property(nonatomic, strong) XPUserCardItemModel *cellModel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation UserRoomMicPositionCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self.contentView addSubview:self.iconImageView];
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.trailing.mas_equalTo(self.contentView);
|
||||
make.height.mas_equalTo(self.iconImageView.mas_width);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.contentLabel];
|
||||
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.iconImageView.mas_bottom).offset(4);
|
||||
make.bottom.mas_equalTo(self.contentView);
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setCellModel:(XPUserCardItemModel *)cellModel {
|
||||
_cellModel = cellModel;
|
||||
self.iconImageView.image = kImage(cellModel.imageName);
|
||||
self.contentLabel.text = cellModel.title;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (UIImageView *)iconImageView {
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] initWithImage:kImage(@"room_user_position_empty")];
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)contentLabel {
|
||||
if (!_contentLabel) {
|
||||
_contentLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[UIColor whiteColor]];
|
||||
}
|
||||
return _contentLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface UserRoomMicPositionView : UIView <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
|
||||
@property(nonatomic, strong) UILabel *titleLabel;
|
||||
@property(nonatomic, strong) UIButton *comfirmButton;
|
||||
@property(nonatomic, copy) NSArray <XPUserCardItemModel *>*dataSource;
|
||||
@property(nonatomic, strong) UICollectionView *collectionView;
|
||||
@property(nonatomic, copy) void(^handleTapPosition)(XPUserCardItemModel *model);
|
||||
@property(nonatomic, copy) void(^handleDismiss)(void);
|
||||
|
||||
@end
|
||||
|
||||
@implementation UserRoomMicPositionView
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (self.handleDismiss) {
|
||||
self.handleDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.backgroundColor = [UIColor blackColor];
|
||||
[self setCornerRadius:16 cornerMask:kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner];
|
||||
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.mas_equalTo(15);
|
||||
make.height.mas_equalTo(22);
|
||||
}];
|
||||
|
||||
[self addSubview:self.comfirmButton];
|
||||
[self.comfirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.titleLabel);
|
||||
make.trailing.mas_equalTo(-15);
|
||||
make.size.mas_equalTo(CGSizeMake(48, 44));
|
||||
}];
|
||||
|
||||
[self addSubview:self.collectionView];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
|
||||
make.leading.bottom.trailing.mas_equalTo(self);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setDataSource:(NSArray<XPUserCardItemModel *> *)dataSource {
|
||||
_dataSource = dataSource;
|
||||
if (dataSource.count == 9) {
|
||||
Custom9MicLayout *customLayout = [[Custom9MicLayout alloc] init];
|
||||
self.collectionView.collectionViewLayout = customLayout;
|
||||
} else if (dataSource.count == 19) {
|
||||
Custom19MicLayout *customLayout = [[Custom19MicLayout alloc] init];
|
||||
self.collectionView.collectionViewLayout = customLayout;
|
||||
}
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (void)didTapComfirm {
|
||||
CGRect r = CGRectMake(0, KScreenHeight, self.frame.size.width, self.frame.size.height);
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
self.frame = r;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
if (self.handleDismiss) {
|
||||
self.handleDismiss();
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
|
||||
if (self.dataSource.count == 9) {
|
||||
return 3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
if (self.dataSource.count == 9) {
|
||||
switch (section) {
|
||||
case 0:
|
||||
return 1;
|
||||
break;
|
||||
case 1:
|
||||
return 4;
|
||||
break;
|
||||
case 2:
|
||||
return 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return self.dataSource.count;
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UserRoomMicPositionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"UserRoomMicPositionCell"
|
||||
forIndexPath:indexPath];
|
||||
if (self.dataSource.count == 9) {
|
||||
switch (indexPath.section) {
|
||||
case 0:
|
||||
cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row];
|
||||
break;
|
||||
case 1:
|
||||
cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row+1];
|
||||
break;
|
||||
case 2:
|
||||
cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row+5];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row];
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (_handleTapPosition) {
|
||||
if (self.dataSource.count == 9) {
|
||||
switch (indexPath.section) {
|
||||
case 0:
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row]);
|
||||
break;
|
||||
case 1:
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row+1]);
|
||||
break;
|
||||
case 2:
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row+5]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (self.dataSource.count == 19) {
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row]);
|
||||
} else {
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row]);
|
||||
}
|
||||
}
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (UICollectionView *)collectionView {
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(50, 50 + 4 + 17);
|
||||
layout.minimumLineSpacing = 14;
|
||||
layout.minimumInteritemSpacing = 23;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 15, kSafeAreaBottomHeight, 15);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[UserRoomMicPositionCell class] forCellWithReuseIdentifier:@"UserRoomMicPositionCell"];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.31_text_4")
|
||||
font:kFontSemibold(16)
|
||||
textColor:[UIColor whiteColor]];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)comfirmButton {
|
||||
if (!_comfirmButton) {
|
||||
_comfirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_comfirmButton setTitleColor:UIColorFromRGB(0xFF8C03) forState:UIControlStateNormal];
|
||||
[_comfirmButton setTitle:YMLocalizedString(@"TTAlertConfig0") forState:UIControlStateNormal];
|
||||
[_comfirmButton addTarget:self
|
||||
action:@selector(didTapComfirm)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _comfirmButton;
|
||||
}
|
||||
|
||||
@end
|
||||
// 导入自定义布局和视图
|
||||
#import "Custom19MicLayout.h"
|
||||
#import "Custom9MicLayout.h"
|
||||
#import "UserRoomMicPositionView.h"
|
||||
|
||||
@interface UserRoomCardInfoCell : UICollectionViewCell
|
||||
@property(nonatomic, copy) void(^tapReport)(void);
|
||||
@@ -1071,6 +701,12 @@
|
||||
|
||||
- (void)dealloc {
|
||||
[XNDJTDDLoadingTool hideHUD];
|
||||
|
||||
// 停止并清理 topMP4View 资源
|
||||
if (_topMP4View) {
|
||||
[_topMP4View stopHWDMP4];
|
||||
_topMP4View = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithUser:(XPUserCardInfoModel *)cardInfo controlUser:(nonnull UserInfoModel *)meInfo {
|
||||
|
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// UserRoomMicPositionCell.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/12/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XPUserCardItemModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 房间麦位选择 Cell
|
||||
@interface UserRoomMicPositionCell : UICollectionViewCell
|
||||
|
||||
@property(nonatomic, strong) UIImageView *iconImageView;
|
||||
@property(nonatomic, strong) UILabel *contentLabel;
|
||||
@property(nonatomic, assign) BOOL isUsed;
|
||||
@property(nonatomic, strong) XPUserCardItemModel *cellModel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// UserRoomMicPositionCell.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/12/11.
|
||||
//
|
||||
|
||||
#import "UserRoomMicPositionCell.h"
|
||||
|
||||
@implementation UserRoomMicPositionCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self.contentView addSubview:self.iconImageView];
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.trailing.mas_equalTo(self.contentView);
|
||||
make.height.mas_equalTo(self.iconImageView.mas_width);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.contentLabel];
|
||||
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.iconImageView.mas_bottom).offset(4);
|
||||
make.bottom.mas_equalTo(self.contentView);
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setCellModel:(XPUserCardItemModel *)cellModel {
|
||||
_cellModel = cellModel;
|
||||
self.iconImageView.image = kImage(cellModel.imageName);
|
||||
self.contentLabel.text = cellModel.title;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (UIImageView *)iconImageView {
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] initWithImage:kImage(@"room_user_position_empty")];
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)contentLabel {
|
||||
if (!_contentLabel) {
|
||||
_contentLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[UIColor whiteColor]];
|
||||
}
|
||||
return _contentLabel;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// UserRoomMicPositionView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/12/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XPUserCardItemModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 房间麦位选择视图
|
||||
@interface UserRoomMicPositionView : UIView <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
|
||||
@property(nonatomic, strong) UILabel *titleLabel;
|
||||
@property(nonatomic, strong) UIButton *comfirmButton;
|
||||
@property(nonatomic, copy) NSArray <XPUserCardItemModel *>*dataSource;
|
||||
@property(nonatomic, strong) UICollectionView *collectionView;
|
||||
@property(nonatomic, copy) void(^handleTapPosition)(XPUserCardItemModel *model);
|
||||
@property(nonatomic, copy) void(^handleDismiss)(void);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
189
YuMi/Modules/YMRoom/View/UserCard/View/UserRoomMicPositionView.m
Normal file
189
YuMi/Modules/YMRoom/View/UserCard/View/UserRoomMicPositionView.m
Normal file
@@ -0,0 +1,189 @@
|
||||
//
|
||||
// UserRoomMicPositionView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/12/11.
|
||||
//
|
||||
|
||||
#import "UserRoomMicPositionView.h"
|
||||
#import "UserRoomMicPositionCell.h"
|
||||
#import "Custom9MicLayout.h"
|
||||
#import "Custom19MicLayout.h"
|
||||
|
||||
@implementation UserRoomMicPositionView
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (self.handleDismiss) {
|
||||
self.handleDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.backgroundColor = [UIColor blackColor];
|
||||
[self setCornerRadius:16 cornerMask:kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner];
|
||||
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.mas_equalTo(15);
|
||||
make.height.mas_equalTo(22);
|
||||
}];
|
||||
|
||||
[self addSubview:self.comfirmButton];
|
||||
[self.comfirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.titleLabel);
|
||||
make.trailing.mas_equalTo(-15);
|
||||
make.size.mas_equalTo(CGSizeMake(48, 44));
|
||||
}];
|
||||
|
||||
[self addSubview:self.collectionView];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
|
||||
make.leading.bottom.trailing.mas_equalTo(self);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setDataSource:(NSArray<XPUserCardItemModel *> *)dataSource {
|
||||
_dataSource = dataSource;
|
||||
if (dataSource.count == 9) {
|
||||
Custom9MicLayout *customLayout = [[Custom9MicLayout alloc] init];
|
||||
self.collectionView.collectionViewLayout = customLayout;
|
||||
} else if (dataSource.count == 19) {
|
||||
Custom19MicLayout *customLayout = [[Custom19MicLayout alloc] init];
|
||||
self.collectionView.collectionViewLayout = customLayout;
|
||||
}
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (void)didTapComfirm {
|
||||
CGRect r = CGRectMake(0, KScreenHeight, self.frame.size.width, self.frame.size.height);
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
self.frame = r;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
if (self.handleDismiss) {
|
||||
self.handleDismiss();
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDataSource
|
||||
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
|
||||
if (self.dataSource.count == 9) {
|
||||
return 3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
if (self.dataSource.count == 9) {
|
||||
switch (section) {
|
||||
case 0:
|
||||
return 1;
|
||||
break;
|
||||
case 1:
|
||||
return 4;
|
||||
break;
|
||||
case 2:
|
||||
return 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return self.dataSource.count;
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UserRoomMicPositionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"UserRoomMicPositionCell"
|
||||
forIndexPath:indexPath];
|
||||
if (self.dataSource.count == 9) {
|
||||
switch (indexPath.section) {
|
||||
case 0:
|
||||
cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row];
|
||||
break;
|
||||
case 1:
|
||||
cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row+1];
|
||||
break;
|
||||
case 2:
|
||||
cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row+5];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row];
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (_handleTapPosition) {
|
||||
if (self.dataSource.count == 9) {
|
||||
switch (indexPath.section) {
|
||||
case 0:
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row]);
|
||||
break;
|
||||
case 1:
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row+1]);
|
||||
break;
|
||||
case 2:
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row+5]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (self.dataSource.count == 19) {
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row]);
|
||||
} else {
|
||||
self.handleTapPosition([self.dataSource xpSafeObjectAtIndex:indexPath.row]);
|
||||
}
|
||||
}
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
||||
#pragma mark - Getters
|
||||
- (UICollectionView *)collectionView {
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(50, 50 + 4 + 17);
|
||||
layout.minimumLineSpacing = 14;
|
||||
layout.minimumInteritemSpacing = 23;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 15, kSafeAreaBottomHeight, 15);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[UserRoomMicPositionCell class] forCellWithReuseIdentifier:@"UserRoomMicPositionCell"];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.31_text_4")
|
||||
font:kFontSemibold(16)
|
||||
textColor:[UIColor whiteColor]];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)comfirmButton {
|
||||
if (!_comfirmButton) {
|
||||
_comfirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_comfirmButton setTitleColor:UIColorFromRGB(0xFF8C03) forState:UIControlStateNormal];
|
||||
[_comfirmButton setTitle:YMLocalizedString(@"TTAlertConfig0") forState:UIControlStateNormal];
|
||||
[_comfirmButton addTarget:self
|
||||
action:@selector(didTapComfirm)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _comfirmButton;
|
||||
}
|
||||
|
||||
@end
|
@@ -484,7 +484,7 @@ UIKIT_EXTERN NSString *kRoomKickoutTime;
|
||||
NSMutableDictionary *lastRoomInfoDic = [NSMutableDictionary dictionaryWithDictionary:[self.roomInfo model2dictionary]];
|
||||
[lastRoomInfoDic addEntriesFromDictionary: ((NSString *)data[@"roomInfo"]).toJSONObject];
|
||||
RoomInfoModel *newRoomInfo = [RoomInfoModel modelWithJSON:lastRoomInfoDic];
|
||||
//TODO: 从小游戏房间切换到普通房间的话 mgid不会被清除掉
|
||||
|
||||
if (newRoomInfo.type != RoomType_MiniGame) {
|
||||
newRoomInfo.mgId = 0;
|
||||
}
|
||||
|
@@ -1881,7 +1881,7 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
NSMutableDictionary *lastRoomInfoDic = [NSMutableDictionary dictionaryWithDictionary:[self.roomInfo model2dictionary]];
|
||||
[lastRoomInfoDic addEntriesFromDictionary: ((NSString *)data[@"roomInfo"]).toJSONObject];
|
||||
RoomInfoModel *newRoomInfo = [RoomInfoModel modelWithJSON:lastRoomInfoDic];
|
||||
//TODO: 从小游戏房间切换到普通房间的话 mgid不会被清除掉
|
||||
|
||||
if (newRoomInfo.type != RoomType_MiniGame) {
|
||||
newRoomInfo.mgId = 0;
|
||||
}
|
||||
|
@@ -4178,7 +4178,7 @@ ineHeadView12" = "الحمل";
|
||||
"20.20.59_text_7" = " شارك";
|
||||
"20.20.59_text_8" = "إنشاء الحدث";
|
||||
"20.20.59_text_9" = "عنوان الحدث";
|
||||
"20.20.59_text_10" = "بنر الفعالية(Best size:690*236)";
|
||||
"20.20.59_text_10" = "بنر الفعاليةلافتة الحدث (الحجم الأمثل: 690*236)";
|
||||
"20.20.59_text_11" = "رفع بنر إلى الصفحة الرئيسية(%@التكاليف )";
|
||||
"20.20.59_text_12" = "نعم";
|
||||
"20.20.59_text_13" = "لا ";
|
||||
|
@@ -3963,7 +3963,7 @@
|
||||
"20.20.59_text_7" = " Participate";
|
||||
"20.20.59_text_8" = "Create Event";
|
||||
"20.20.59_text_9" = "Event Title";
|
||||
"20.20.59_text_10" = "Event Banner(Best size:690*236)";
|
||||
"20.20.59_text_10" = "Event Banner(Best size:690*236) ";
|
||||
"20.20.59_text_11" = "Upload Banner to Homepage(Costs %@)";
|
||||
"20.20.59_text_12" = "YES";
|
||||
"20.20.59_text_13" = "NO";
|
||||
|
@@ -3756,7 +3756,7 @@
|
||||
"20.20.59_text_7" = " Katılmak";
|
||||
"20.20.59_text_8" = "Etkinlik Oluştur";
|
||||
"20.20.59_text_9" = "Etkinlik Başlığı";
|
||||
"20.20.59_text_10" = "Etkinlik Afişi(Best size:690*236)";
|
||||
"20.20.59_text_10" = "Etkinlik Banner'ı (En iyi boyut: 690*236)";
|
||||
"20.20.59_text_11" = "Ana Sayfaya Banner Yükleyin(Maliyet %@)";
|
||||
"20.20.59_text_12" = "Evet";
|
||||
"20.20.59_text_13" = "Hayır";
|
||||
|
@@ -3628,7 +3628,7 @@
|
||||
"20.20.59_text_7" = " 參與活動";
|
||||
"20.20.59_text_8" = "建立活動";
|
||||
"20.20.59_text_9" = "活動標題";
|
||||
"20.20.59_text_10" = "活動橫幅(Best size:690*236)";
|
||||
"20.20.59_text_10" = "活動橫幅(最佳尺寸:690*236)";
|
||||
"20.20.59_text_11" = "上傳橫幅至首頁(成本 %@)";
|
||||
"20.20.59_text_12" = "有";
|
||||
"20.20.59_text_13" = "無";
|
||||
|
Reference in New Issue
Block a user