房间UI布局的完善 事件的添加

This commit is contained in:
fengshuo
2021-10-20 19:06:44 +08:00
committed by zu
parent 55711037fa
commit 74807f8bc3
23 changed files with 319 additions and 18 deletions

View File

@@ -36,7 +36,8 @@ target 'xplan-ios' do
#声网 #声网
pod 'AgoraRtcEngine_iOS', '~> 3.0.1' pod 'AgoraRtcEngine_iOS', '~> 3.0.1'
#pop动画
pod 'pop', '~> 1.0.12'
#登录的 #登录的
pod 'mob_sharesdk' pod 'mob_sharesdk'
pod 'mob_sharesdk/ShareSDKPlatforms/QQ' pod 'mob_sharesdk/ShareSDKPlatforms/QQ'

View File

@@ -41,6 +41,7 @@ PODS:
- MOBFoundation (>= 3.2.9) - MOBFoundation (>= 3.2.9)
- MOBFoundation (3.2.27) - MOBFoundation (3.2.27)
- NTESQuickPass (2.1.9) - NTESQuickPass (2.1.9)
- pop (1.0.12)
- Qiniu (8.3.2): - Qiniu (8.3.2):
- HappyDNS (~> 0.3.17) - HappyDNS (~> 0.3.17)
- ReactiveObjC (3.1.1) - ReactiveObjC (3.1.1)
@@ -70,6 +71,7 @@ DEPENDENCIES:
- mob_sharesdk/ShareSDKPlatforms/QQ - mob_sharesdk/ShareSDKPlatforms/QQ
- mob_sharesdk/ShareSDKPlatforms/WeChat - mob_sharesdk/ShareSDKPlatforms/WeChat
- NTESQuickPass (~> 2.1.6) - NTESQuickPass (~> 2.1.6)
- pop (~> 1.0.12)
- Qiniu - Qiniu
- ReactiveObjC - ReactiveObjC
- SDCycleScrollView - SDCycleScrollView
@@ -95,6 +97,7 @@ SPEC REPOS:
- mob_sharesdk - mob_sharesdk
- MOBFoundation - MOBFoundation
- NTESQuickPass - NTESQuickPass
- pop
- Qiniu - Qiniu
- ReactiveObjC - ReactiveObjC
- SDCycleScrollView - SDCycleScrollView
@@ -119,6 +122,7 @@ SPEC CHECKSUMS:
mob_sharesdk: a60006891a079486ff3269ed326adfa05a967c01 mob_sharesdk: a60006891a079486ff3269ed326adfa05a967c01
MOBFoundation: efdc3ce6b843fbc10ae8c1c6122a02b0d845b39b MOBFoundation: efdc3ce6b843fbc10ae8c1c6122a02b0d845b39b
NTESQuickPass: 8431dc52737c95883cd382c2ee75664d58f39377 NTESQuickPass: 8431dc52737c95883cd382c2ee75664d58f39377
pop: d582054913807fd11fd50bfe6a539d91c7e1a55a
Qiniu: 61f1e2fdfb35b37f98c8f03a718faf12652f9994 Qiniu: 61f1e2fdfb35b37f98c8f03a718faf12652f9994
ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040 ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040
SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf
@@ -127,6 +131,6 @@ SPEC CHECKSUMS:
SZTextView: 094dc6acc9beec537685c545d6e3e0d4975174e1 SZTextView: 094dc6acc9beec537685c545d6e3e0d4975174e1
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849 YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
PODFILE CHECKSUM: 10f014ae106af90b11a01aa549879c0e566b93e3 PODFILE CHECKSUM: db33c042062a7ccc33a5468e35a1c606fb3f4e98
COCOAPODS: 1.10.1 COCOAPODS: 1.10.1

View File

@@ -105,6 +105,7 @@
E81C27AB26EF2D920031E639 /* ThirdUserInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C27AA26EF2D920031E639 /* ThirdUserInfo.m */; }; E81C27AB26EF2D920031E639 /* ThirdUserInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C27AA26EF2D920031E639 /* ThirdUserInfo.m */; };
E81C27AE26EF39AB0031E639 /* AppDelegate+ThirdConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C27AD26EF39AB0031E639 /* AppDelegate+ThirdConfig.m */; }; E81C27AE26EF39AB0031E639 /* AppDelegate+ThirdConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C27AD26EF39AB0031E639 /* AppDelegate+ThirdConfig.m */; };
E81D587E271FC1EB003063FE /* XPRoomViewController+SDKConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E81D587D271FC1EB003063FE /* XPRoomViewController+SDKConfig.m */; }; E81D587E271FC1EB003063FE /* XPRoomViewController+SDKConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E81D587D271FC1EB003063FE /* XPRoomViewController+SDKConfig.m */; };
E81D58822720082A003063FE /* XPRoomPositionItemSpeakingView.m in Sources */ = {isa = PBXBuildFile; fileRef = E81D58812720082A003063FE /* XPRoomPositionItemSpeakingView.m */; };
E82109AD26F1C8A000FC3319 /* CountDownHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E82109AC26F1C8A000FC3319 /* CountDownHelper.m */; }; E82109AD26F1C8A000FC3319 /* CountDownHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E82109AC26F1C8A000FC3319 /* CountDownHelper.m */; };
E82109B026F1D83500FC3319 /* LoginBindPhonePresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E82109AF26F1D83500FC3319 /* LoginBindPhonePresent.m */; }; E82109B026F1D83500FC3319 /* LoginBindPhonePresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E82109AF26F1D83500FC3319 /* LoginBindPhonePresent.m */; };
E824543526F57D6E00BE8163 /* XPLoginVerifBindPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E824543426F57D6E00BE8163 /* XPLoginVerifBindPhoneViewController.m */; }; E824543526F57D6E00BE8163 /* XPLoginVerifBindPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E824543426F57D6E00BE8163 /* XPLoginVerifBindPhoneViewController.m */; };
@@ -422,6 +423,8 @@
E81D587B271FBC3B003063FE /* RtcInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RtcInterface.h; sourceTree = "<group>"; }; E81D587B271FBC3B003063FE /* RtcInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RtcInterface.h; sourceTree = "<group>"; };
E81D587C271FC1EB003063FE /* XPRoomViewController+SDKConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "XPRoomViewController+SDKConfig.h"; sourceTree = "<group>"; }; E81D587C271FC1EB003063FE /* XPRoomViewController+SDKConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "XPRoomViewController+SDKConfig.h"; sourceTree = "<group>"; };
E81D587D271FC1EB003063FE /* XPRoomViewController+SDKConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "XPRoomViewController+SDKConfig.m"; sourceTree = "<group>"; }; E81D587D271FC1EB003063FE /* XPRoomViewController+SDKConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "XPRoomViewController+SDKConfig.m"; sourceTree = "<group>"; };
E81D58802720082A003063FE /* XPRoomPositionItemSpeakingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomPositionItemSpeakingView.h; sourceTree = "<group>"; };
E81D58812720082A003063FE /* XPRoomPositionItemSpeakingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomPositionItemSpeakingView.m; sourceTree = "<group>"; };
E82109AB26F1C8A000FC3319 /* CountDownHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CountDownHelper.h; sourceTree = "<group>"; }; E82109AB26F1C8A000FC3319 /* CountDownHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CountDownHelper.h; sourceTree = "<group>"; };
E82109AC26F1C8A000FC3319 /* CountDownHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CountDownHelper.m; sourceTree = "<group>"; }; E82109AC26F1C8A000FC3319 /* CountDownHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CountDownHelper.m; sourceTree = "<group>"; };
E82109AE26F1D83500FC3319 /* LoginBindPhonePresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginBindPhonePresent.h; sourceTree = "<group>"; }; E82109AE26F1D83500FC3319 /* LoginBindPhonePresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginBindPhonePresent.h; sourceTree = "<group>"; };
@@ -1291,6 +1294,15 @@
path = AppDelegate; path = AppDelegate;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
E81D587F27200804003063FE /* SeapkingView */ = {
isa = PBXGroup;
children = (
E81D58802720082A003063FE /* XPRoomPositionItemSpeakingView.h */,
E81D58812720082A003063FE /* XPRoomPositionItemSpeakingView.m */,
);
path = SeapkingView;
sourceTree = "<group>";
};
E82109AA26F1C86E00FC3319 /* CountDown */ = { E82109AA26F1C86E00FC3319 /* CountDown */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@@ -1358,6 +1370,7 @@
E86807152719678B0024F48F /* View */ = { E86807152719678B0024F48F /* View */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E81D587F27200804003063FE /* SeapkingView */,
E8680716271967B00024F48F /* XPRoomPostionBaseItemView.h */, E8680716271967B00024F48F /* XPRoomPostionBaseItemView.h */,
E8680717271967B00024F48F /* XPRoomPostionBaseItemView.m */, E8680717271967B00024F48F /* XPRoomPostionBaseItemView.m */,
E8680719271969A50024F48F /* XCRoomPostionNickView.h */, E8680719271969A50024F48F /* XCRoomPostionNickView.h */,
@@ -2048,6 +2061,7 @@
18E7B1B726E8B2D10064BC9B /* Api+Main.m in Sources */, 18E7B1B726E8B2D10064BC9B /* Api+Main.m in Sources */,
E8B846D326FDDBE600A777FE /* XPMineRechargeTableViewCell.m in Sources */, E8B846D326FDDBE600A777FE /* XPMineRechargeTableViewCell.m in Sources */,
E824546126F5F4E400BE8163 /* XPMineResetPayPwdViewController.m in Sources */, E824546126F5F4E400BE8163 /* XPMineResetPayPwdViewController.m in Sources */,
E81D58822720082A003063FE /* XPRoomPositionItemSpeakingView.m in Sources */,
E8B825C226EA00DF009E8E9F /* LoginVerifCodePresent.m in Sources */, E8B825C226EA00DF009E8E9F /* LoginVerifCodePresent.m in Sources */,
E88B5CB026FB1C6500DA9178 /* XPMineTeenagerPresenter.m in Sources */, E88B5CB026FB1C6500DA9178 /* XPMineTeenagerPresenter.m in Sources */,
186A534B26FC6ED900D67B2C /* TTPopupManagerService.m in Sources */, 186A534B26FC6ED900D67B2C /* TTPopupManagerService.m in Sources */,

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

View File

@@ -104,7 +104,8 @@ static NSString *const kSheetViewCellConst = @"kSheetViewCellConst";
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self; _tableView.delegate = self;
_tableView.dataSource = self; _tableView.dataSource = self;
_tableView.separatorColor = [ThemeColor dividerColor]; _tableView.separatorColor = [ThemeColor actionSeparatorColor];
_tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
_tableView.rowHeight = kSheetViewCellHeight; _tableView.rowHeight = kSheetViewCellHeight;
_tableView.tableFooterView = [[UIView alloc] init]; _tableView.tableFooterView = [[UIView alloc] init];
_tableView.backgroundColor = [UIColor whiteColor]; _tableView.backgroundColor = [UIColor whiteColor];

View File

@@ -51,6 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (UIColor *)alertBackgroundColor; + (UIColor *)alertBackgroundColor;
+ (UIColor *)alertTitleColor; + (UIColor *)alertTitleColor;
+ (UIColor *)alertMessageColor; + (UIColor *)alertMessageColor;
+ (UIColor *)actionSeparatorColor;
/* ------弹窗相关颜色 END------ */ /* ------弹窗相关颜色 END------ */
///tabbar 没有点击的时候颜色555574 ///tabbar 没有点击的时候颜色555574

View File

@@ -87,6 +87,10 @@
+ (UIColor *)alertMessageColor { + (UIColor *)alertMessageColor {
return UIColorFromRGB(0x333333); return UIColorFromRGB(0x333333);
} }
+ (UIColor *)actionSeparatorColor {
return UIColorFromRGB(0xF0F0F0);
}
/* ------ END------ */ /* ------ END------ */
///tabbar 555574 ///tabbar 555574

View File

@@ -19,7 +19,8 @@ typedef NS_ENUM(NSUInteger, URLType) {
kIdentityURL,///实名认证 kIdentityURL,///实名认证
kGameBindAccountURL, kGameBindAccountURL,
kNurseryURL,///护苗计划 kNurseryURL,///护苗计划
kRechargePrivacyURL////充值协议 kRechargePrivacyURL,////充值协议
kReportRoomURL,///举报房间
}; };
NSString * const URLWithType(URLType type); NSString * const URLWithType(URLType type);

View File

@@ -20,6 +20,7 @@ NSString * const URLWithType(URLType type) {
@(kGameBindAccountURL):@"modules/game/bindAccount.html",/// @(kGameBindAccountURL):@"modules/game/bindAccount.html",///
@(kNurseryURL):@"activity/cleanNet/index.html", @(kNurseryURL):@"activity/cleanNet/index.html",
@(kRechargePrivacyURL) : @"modules/rule/rechargeAgreement.html",// @(kRechargePrivacyURL) : @"modules/rule/rechargeAgreement.html",//
@(kReportRoomURL) : @"modules/inform/index.html",///
}; };
NSString * url = [dic objectForKey:@(type)]; NSString * url = [dic objectForKey:@(type)];

View File

@@ -6,6 +6,13 @@
// //
#import "XPRoomViewController+RoomInfoContainerView.h" #import "XPRoomViewController+RoomInfoContainerView.h"
///Tool
#import "TTPopup.h"
#import "XPHtmlUrl.h"
///Model
#import "RoomInfoModel.h"
///VC
#import "XPWebViewController.h"
@implementation XPRoomViewController (RoomInfoContainerView) @implementation XPRoomViewController (RoomInfoContainerView)
@@ -21,10 +28,31 @@
- (void)xpRoomInfoContainerView:(XPRoomInfoContainerView *)view didClickSettingButton:(UIButton *)sender { - (void)xpRoomInfoContainerView:(XPRoomInfoContainerView *)view didClickSettingButton:(UIButton *)sender {
TTActionSheetConfig *exitRoom = [TTActionSheetConfig normalTitle:@"退出房间" clickAction:^{
}];
TTActionSheetConfig *mineRoom = [TTActionSheetConfig normalTitle:@"最小化房间" clickAction:^{
[self disMissRoomVC];
}];
TTActionSheetConfig *reportRoom = [TTActionSheetConfig normalTitle:@"举报房间" clickAction:^{
[self pushReportRoomWebVC];
}];
[TTPopup actionSheetWithItems:@[exitRoom, mineRoom, reportRoom]];
} }
#pragma mark - Private Method #pragma mark - Private Method
- (void)pushReportRoomWebVC {
XPWebViewController *vc = [[XPWebViewController alloc]init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%ld&source=ROOM",URLWithType(kReportRoomURL),self.roomInfo.uid];
vc.url = urlstr;
[self.navigationController pushViewController:vc animated:YES];
}
@end @end

View File

@@ -12,6 +12,7 @@
@implementation XPRoomViewController (SDKConfig) @implementation XPRoomViewController (SDKConfig)
- (void)configEnterRoomSDK { - (void)configEnterRoomSDK {
[RtcManager initEngineWithType:RtcEngineType_Agora delegate:self];
[[RtcManager instance] joinChannel:[NSString stringWithFormat:@"%ld", (long)self.roomInfo.uid] broadcast:YES]; [[RtcManager instance] joinChannel:[NSString stringWithFormat:@"%ld", (long)self.roomInfo.uid] broadcast:YES];
} }

View File

@@ -6,11 +6,18 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
///Model
#import "XPRoomMenuItem.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class XPRoomMenuContainerView;
@protocol XPRoomMenuContainerViewDelegate <NSObject>
///点击了某个item
- (void)xpRoomMenuContainerView:(XPRoomMenuContainerView *)view didClickItem:(XPRoomMenuItemType)itemType;
@end
@interface XPRoomMenuContainerView : UIView @interface XPRoomMenuContainerView : UIView
///代理
@property (nonatomic,weak) id<XPRoomMenuContainerViewDelegate> delegate;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -46,7 +46,9 @@
} }
#pragma mark - Response #pragma mark - Response
- (void)menuButtonAction:(UIButton *)sender { - (void)menuButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpRoomMenuContainerView:didClickItem:)]) {
[self.delegate xpRoomMenuContainerView:self didClickItem:sender.tag];
}
} }
#pragma mark - Private Method #pragma mark - Private Method
@@ -88,6 +90,7 @@
[_inputButton setBackgroundImage:[UIImage imageNamed:@"room_menu_input_bg"] forState:UIControlStateNormal]; [_inputButton setBackgroundImage:[UIImage imageNamed:@"room_menu_input_bg"] forState:UIControlStateNormal];
_inputButton.tag = XPRoomMenuItemType_Input; _inputButton.tag = XPRoomMenuItemType_Input;
[_inputButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_inputButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_inputButton.hidden = YES;
} }
return _inputButton; return _inputButton;
} }
@@ -121,6 +124,7 @@
[_faceButton setImage:[UIImage imageNamed:@"room_menu_face"] forState:UIControlStateSelected]; [_faceButton setImage:[UIImage imageNamed:@"room_menu_face"] forState:UIControlStateSelected];
_faceButton.tag = XPRoomMenuItemType_Face; _faceButton.tag = XPRoomMenuItemType_Face;
[_faceButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_faceButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_faceButton.hidden = YES;
} }
return _faceButton; return _faceButton;
} }
@@ -132,6 +136,7 @@
[_messageButton setImage:[UIImage imageNamed:@"room_menu_new_message"] forState:UIControlStateSelected]; [_messageButton setImage:[UIImage imageNamed:@"room_menu_new_message"] forState:UIControlStateSelected];
_messageButton.tag = XPRoomMenuItemType_Message; _messageButton.tag = XPRoomMenuItemType_Message;
[_messageButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_messageButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_messageButton.hidden = YES;
} }
return _messageButton; return _messageButton;
} }
@@ -141,8 +146,9 @@
_moreButton = [UIButton buttonWithType:UIButtonTypeCustom]; _moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_moreButton setImage:[UIImage imageNamed:@"room_menu_more"] forState:UIControlStateNormal]; [_moreButton setImage:[UIImage imageNamed:@"room_menu_more"] forState:UIControlStateNormal];
[_moreButton setImage:[UIImage imageNamed:@"room_menu_more"] forState:UIControlStateSelected]; [_moreButton setImage:[UIImage imageNamed:@"room_menu_more"] forState:UIControlStateSelected];
_moreButton.tag = XPRoomMenuItemType_Voice; _moreButton.tag = XPRoomMenuItemType_More;
[_moreButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_moreButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_moreButton.hidden = YES;
} }
return _moreButton; return _moreButton;
} }
@@ -152,8 +158,9 @@
_giftButton = [UIButton buttonWithType:UIButtonTypeCustom]; _giftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_giftButton setImage:[UIImage imageNamed:@"room_menu_gift"] forState:UIControlStateNormal]; [_giftButton setImage:[UIImage imageNamed:@"room_menu_gift"] forState:UIControlStateNormal];
[_giftButton setImage:[UIImage imageNamed:@"room_menu_gift"] forState:UIControlStateSelected]; [_giftButton setImage:[UIImage imageNamed:@"room_menu_gift"] forState:UIControlStateSelected];
_giftButton.tag = XPRoomMenuItemType_Voice; _giftButton.tag = XPRoomMenuItemType_Gift;
[_giftButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_giftButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_giftButton.hidden = YES;
} }
return _giftButton; return _giftButton;
} }

View File

@@ -10,6 +10,9 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol XPRoomPositionDataSourceProtocol <NSObject> @protocol XPRoomPositionDataSourceProtocol <NSObject>
@optional;
///为坑位的昵称赋值
- (void)configPositionItemTitle:(NSString *)title;
@end @end

View File

@@ -0,0 +1,20 @@
//
// XPRoomPositionItemSpeakingView.h
// xplan-ios
//
// Created by 冯硕 on 2021/10/20.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomPositionItemSpeakingView : UIView
///开始展示声波动画
- (void)startSpeakingAnimation;
///结束声波动画
- (void)stopSpeakingAnimation;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,114 @@
//
// XPRoomPositionItemSpeakingView.m
// xplan-ios
//
// Created by on 2021/10/20.
//
#import "XPRoomPositionItemSpeakingView.h"
///Third
#import <Masonry/Masonry.h>
#import <POP.h>
@interface XPRoomPositionItemSpeakingView ()
//
@property (nonatomic,strong) UIView * firstView;
///
@property (nonatomic,assign) BOOL isAnimationing;
@end
@implementation XPRoomPositionItemSpeakingView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.firstView.layer.cornerRadius = self.frame.size.width / 2;
}
#pragma mark - Public Method
///
- (void)startSpeakingAnimation {
NSLog(@"开始动画");
if (self.isAnimationing) {
return;
}
self.isAnimationing = YES;
[self animationWithLayer:self.firstView];
}
///
- (void)stopSpeakingAnimation {
self.isAnimationing = NO;
[self.firstView.layer removeAllAnimations];
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.firstView];
}
- (void)initSubViewConstraints {
[self.firstView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
}
- (void)animationWithLayer:(UIView *)view {
int animtionDura = 2;
POPBasicAnimation *animation2 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerScaleXY];
animation2.beginTime = CACurrentMediaTime();
animation2.duration = animtionDura;
animation2.fromValue = [NSValue valueWithCGSize:CGSizeMake(1.f, 1.f)];
animation2.toValue = [NSValue valueWithCGSize:CGSizeMake(1.3f, 1.3f)];
POPBasicAnimation *animation3 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerOpacity];
animation3.duration = 0.6 * animtionDura;
animation3.beginTime = CACurrentMediaTime();
animation3.fromValue = @1.0;
animation3.toValue = @0.8;
animation3.repeatCount = 1;
animation3.removedOnCompletion = YES;
POPBasicAnimation *animation4 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerOpacity];
animation4.duration = 0.4* animtionDura;
animation4.beginTime = CACurrentMediaTime() + 0.6 * animtionDura;
animation4.fromValue = @0.8;
animation4.toValue = @0.0;
animation4.repeatCount = 1;
animation4.removedOnCompletion = YES;
if (view == self.firstView) {
[animation4 setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
self.isAnimationing = NO;
}];
}
[view.layer pop_addAnimation:animation2 forKey:@"animation2"];
[view.layer pop_addAnimation:animation3 forKey:@"animation3"];
[view.layer pop_addAnimation:animation4 forKey:@"animation4"];
}
#pragma mark - Getters And Setters
- (UIView *)firstView {
if (!_firstView) {
_firstView = [[UIView alloc] init];
_firstView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.3];
_firstView.layer.borderWidth = 1;
_firstView.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _firstView;
}
@end

View File

@@ -31,16 +31,22 @@
}]; }];
} }
#pragma mark - XPRoomPositionDataSourceProtocol
- (void)configPositionItemTitle:(NSString *)title {
self.nickLabel.text = title;
}
#pragma mark - Getters And Setters #pragma mark - Getters And Setters
- (UILabel *)nickLabel { - (UILabel *)nickLabel {
if (!_nickLabel) { if (!_nickLabel) {
_nickLabel = [[UILabel alloc] init]; _nickLabel = [[UILabel alloc] init];
_nickLabel.font = [UIFont systemFontOfSize:11]; _nickLabel.font = [UIFont systemFontOfSize:11];
_nickLabel.textColor = [ThemeColor mainTextColor]; _nickLabel.textColor = [ThemeColor mainTextColor];
_nickLabel.text = @"迷你号";
_nickLabel.textAlignment = NSTextAlignmentCenter; _nickLabel.textAlignment = NSTextAlignmentCenter;
} }
return _nickLabel; return _nickLabel;
} }
@end @end

View File

@@ -6,14 +6,25 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "XPRoomPositionDataSourceProtocol.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface XPRoomPostionBaseItemView : UIView @interface XPRoomPostionBaseItemView : UIView<XPRoomPositionDataSourceProtocol>
///头像 ///头像
@property (nonatomic,strong, readonly) UIImageView *avatarImageView; @property (nonatomic,strong, readonly) UIImageView *avatarImageView;
///坑位的编号
@property (nonatomic,assign) int position;
- (void)initSubViews; - (void)initSubViews;
- (void)initSubViewConstraints; - (void)initSubViewConstraints;
///开始展示声波动画
- (void)startSpeakingAnimation;
///结束声波动画
- (void)stopSpeakingAnimation;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -8,10 +8,13 @@
#import "XPRoomPostionBaseItemView.h" #import "XPRoomPostionBaseItemView.h"
///Third ///Third
#import <Masonry/Masonry.h> #import <Masonry/Masonry.h>
///View
@interface XPRoomPostionBaseItemView () #import "XPRoomPositionItemSpeakingView.h"
@interface XPRoomPostionBaseItemView ()<CAAnimationDelegate>
/// ///
@property (nonatomic,strong) UIImageView *avatarImageView; @property (nonatomic,strong) UIImageView *avatarImageView;
///
@property (nonatomic,strong) XPRoomPositionItemSpeakingView *animationView;
@end @end
@implementation XPRoomPostionBaseItemView @implementation XPRoomPostionBaseItemView
@@ -25,12 +28,27 @@
return self; return self;
} }
#pragma mark - Private Method
#pragma mark - Public Method
///
- (void)startSpeakingAnimation {
[self.animationView startSpeakingAnimation];
}
///
- (void)stopSpeakingAnimation {
[self.animationView stopSpeakingAnimation];
}
- (void)initSubViews { - (void)initSubViews {
[self addSubview:self.animationView];
[self addSubview:self.avatarImageView]; [self addSubview:self.avatarImageView];
} }
- (void)initSubViewConstraints { - (void)initSubViewConstraints {
[self.animationView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.avatarImageView);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self); make.left.right.top.mas_equalTo(self);
make.height.mas_equalTo(self.mas_width); make.height.mas_equalTo(self.mas_width);
@@ -48,4 +66,11 @@
return _avatarImageView; return _avatarImageView;
} }
- (XPRoomPositionItemSpeakingView *)animationView {
if (!_animationView) {
_animationView = [[XPRoomPositionItemSpeakingView alloc] init];
}
return _animationView;
}
@end @end

View File

@@ -6,7 +6,7 @@
// //
#import "XPRoomPositionView.h" #import "XPRoomPositionView.h"
#import "XPRoomPositionDataSourceProtocol.h"
@interface XPRoomPositionView () @interface XPRoomPositionView ()
///UI ///UI
@property (nonatomic,strong) id<XPRoomPositionLayoutProtocol> layout; @property (nonatomic,strong) id<XPRoomPositionLayoutProtocol> layout;
@@ -29,14 +29,26 @@
int number = [self.layout numberOfItems]; int number = [self.layout numberOfItems];
NSArray * array = [self.layout getPositionItemsRect]; NSArray * array = [self.layout getPositionItemsRect];
for (int i = 0; i < number; i++) { for (int i = 0; i < number; i++) {
UIView * view = [self getItemView]; UIView<XPRoomPositionDataSourceProtocol> * view = [self getItemView];
[view configPositionItemTitle:[self getItemTitleWithPosition:i]];
NSValue * rect = [array objectAtIndex:i]; NSValue * rect = [array objectAtIndex:i];
view.frame = rect.CGRectValue; view.frame = rect.CGRectValue;
[self addSubview:view]; [self addSubview:view];
} }
} }
- (NSString *)getItemTitleWithPosition:(int)position {
NSString * title;
if (position == 0) {
title = nil;
} else {
title = [NSString stringWithFormat:@"%d号麦位", position];
}
return title;
}
#pragma mark - XPRoomPositionLayoutProtocol #pragma mark - XPRoomPositionLayoutProtocol
- (UIView *)getItemView { - (UIView<XPRoomPositionDataSourceProtocol> *)getItemView {
Class class = [self.layout classOfPositionItme]; Class class = [self.layout classOfPositionItme];
return [[class alloc] init];; return [[class alloc] init];;
} }

View File

@@ -29,6 +29,8 @@
@property (nonatomic,strong) MarqueeLabel *titleLabel; @property (nonatomic,strong) MarqueeLabel *titleLabel;
/// ///
@property (nonatomic,strong) UIImageView *giftEffectImageView; @property (nonatomic,strong) UIImageView *giftEffectImageView;
///
@property (nonatomic,strong) UIImageView *lockRoomImageView;
/// ///
@property (nonatomic,strong) UIStackView *onlineStackView; @property (nonatomic,strong) UIStackView *onlineStackView;
///绿 ///绿
@@ -89,6 +91,7 @@
[self.titleStackView addArrangedSubview:self.titleLabel]; [self.titleStackView addArrangedSubview:self.titleLabel];
[self.titleStackView addArrangedSubview:self.giftEffectImageView]; [self.titleStackView addArrangedSubview:self.giftEffectImageView];
[self.titleStackView addArrangedSubview:self.lockRoomImageView];
} }
- (void)initSubViewConstraints { - (void)initSubViewConstraints {
@@ -138,6 +141,8 @@
if (_roomInfo) { if (_roomInfo) {
self.titleLabel.text = _roomInfo.title; self.titleLabel.text = _roomInfo.title;
self.idLabel.text = [NSString stringWithFormat:@"音游号:%ld %ld人在线", (long)_roomInfo.erbanNo, (long)(_roomInfo.onlineNum > 0 ? _roomInfo.onlineNum : 0)]; self.idLabel.text = [NSString stringWithFormat:@"音游号:%ld %ld人在线", (long)_roomInfo.erbanNo, (long)(_roomInfo.onlineNum > 0 ? _roomInfo.onlineNum : 0)];
self.giftEffectImageView.hidden = !_roomInfo.hasAnimationEffect;
} }
} }
@@ -157,6 +162,7 @@
[_shareButton setImage:[UIImage imageNamed:@"room_info_share"] forState:UIControlStateNormal]; [_shareButton setImage:[UIImage imageNamed:@"room_info_share"] forState:UIControlStateNormal];
[_shareButton addTarget:self action:@selector(shareButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_shareButton addTarget:self action:@selector(shareButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_shareButton setEnlargeEdgeWithTop:8 right:8 bottom:8 left:8]; [_shareButton setEnlargeEdgeWithTop:8 right:8 bottom:8 left:8];
_shareButton.hidden = YES;
} }
return _shareButton; return _shareButton;
} }
@@ -183,6 +189,7 @@
_collectButton.titleLabel.font = [UIFont systemFontOfSize:12]; _collectButton.titleLabel.font = [UIFont systemFontOfSize:12];
_collectButton.layer.cornerRadius = 11; _collectButton.layer.cornerRadius = 11;
_collectButton.layer.masksToBounds = YES; _collectButton.layer.masksToBounds = YES;
_collectButton.hidden = YES;
} }
return _collectButton; return _collectButton;
} }
@@ -230,6 +237,16 @@
return _giftEffectImageView; return _giftEffectImageView;
} }
- (UIImageView *)lockRoomImageView {
if (!_lockRoomImageView) {
_lockRoomImageView = [[UIImageView alloc] init];
_lockRoomImageView.userInteractionEnabled = YES;
_lockRoomImageView.image = [UIImage imageNamed:@"room_info_lock_room"];
_lockRoomImageView.hidden = YES;
}
return _lockRoomImageView;
}
- (UIStackView *)onlineStackView { - (UIStackView *)onlineStackView {
if (!_onlineStackView) { if (!_onlineStackView) {
_onlineStackView = [[UIStackView alloc] init]; _onlineStackView = [[UIStackView alloc] init];
@@ -261,4 +278,5 @@
} }
@end @end