消息模块-录音的UI
@@ -683,6 +683,7 @@
|
||||
E8D48253278D8228003C1D08 /* AcrossRoomPKPanelModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D48252278D8228003C1D08 /* AcrossRoomPKPanelModel.m */; };
|
||||
E8D48256278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D48255278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m */; };
|
||||
E8D55C9D28113218006935A5 /* MessageMenuModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D55C9C28113218006935A5 /* MessageMenuModel.m */; };
|
||||
E8D55CA0281186D6006935A5 /* SessionAudioRecordView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D55C9F281186D6006935A5 /* SessionAudioRecordView.m */; };
|
||||
E8DACCFB2766EDC60052092C /* MicroGiftValueView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */; };
|
||||
E8DACCFE27673F870052092C /* GiftValueInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFD27673F870052092C /* GiftValueInfoModel.m */; };
|
||||
E8DBB6F927B639A300AA285D /* LittleGameStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DBB6F827B639A300AA285D /* LittleGameStageView.m */; };
|
||||
@@ -2107,6 +2108,8 @@
|
||||
E8D48255278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKPanelUserView.m; sourceTree = "<group>"; };
|
||||
E8D55C9B28113218006935A5 /* MessageMenuModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageMenuModel.h; sourceTree = "<group>"; };
|
||||
E8D55C9C28113218006935A5 /* MessageMenuModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageMenuModel.m; sourceTree = "<group>"; };
|
||||
E8D55C9E281186D6006935A5 /* SessionAudioRecordView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionAudioRecordView.h; sourceTree = "<group>"; };
|
||||
E8D55C9F281186D6006935A5 /* SessionAudioRecordView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SessionAudioRecordView.m; sourceTree = "<group>"; };
|
||||
E8DACCF92766EDC60052092C /* MicroGiftValueView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroGiftValueView.h; sourceTree = "<group>"; };
|
||||
E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroGiftValueView.m; sourceTree = "<group>"; };
|
||||
E8DACCFC27673F870052092C /* GiftValueInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftValueInfoModel.h; sourceTree = "<group>"; };
|
||||
@@ -3145,6 +3148,8 @@
|
||||
18F404B6276095D700A6C548 /* SessionChatLimitView.m */,
|
||||
9B7D804B27537950003DAC0C /* MessageCell.h */,
|
||||
9B7D804C27537950003DAC0C /* MessageCell.m */,
|
||||
E8D55C9E281186D6006935A5 /* SessionAudioRecordView.h */,
|
||||
E8D55C9F281186D6006935A5 /* SessionAudioRecordView.m */,
|
||||
18F403A72758B67900A6C548 /* Content */,
|
||||
E86B911B281034F10007DEE7 /* Cell */,
|
||||
);
|
||||
@@ -6686,6 +6691,8 @@
|
||||
18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */,
|
||||
E8AEAEF927141CA30017FCE0 /* RoomHeaderView.m in Sources */,
|
||||
9B1B729828002147003FACE9 /* XPMineFansTeamPresenter.m in Sources */,
|
||||
E8A88D2A27E81C8600CA8837 /* XPRoomPKUserCollectionViewCell.m in Sources */,
|
||||
E8D55CA0281186D6006935A5 /* SessionAudioRecordView.m in Sources */,
|
||||
9B7B606627BBA0EE0070BB72 /* XPAnchorAttentSendInfo.m in Sources */,
|
||||
E81C1B29277069DD0020D1E4 /* XPArrangeMicEmptyTableViewCell.m in Sources */,
|
||||
E8AC721C26F4720B007D6E91 /* XPMineSettingPresent.m in Sources */,
|
||||
|
22
xplan-ios/Assets.xcassets/SessionMessage/message_tool_audio_record_cancel.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_tool_audio_record_cancel@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_tool_audio_record_cancel@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
22
xplan-ios/Assets.xcassets/SessionMessage/message_tool_audio_record_first.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_tool_audio_record_first@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_tool_audio_record_first@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.0 KiB |
22
xplan-ios/Assets.xcassets/SessionMessage/message_tool_audio_record_second.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_tool_audio_record_second@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_tool_audio_record_second@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.0 KiB |
22
xplan-ios/Assets.xcassets/SessionMessage/message_tool_audio_record_third.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_tool_audio_record_third@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_tool_audio_record_third@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.0 KiB |
18
xplan-ios/Main/Message/View/Session/SessionAudioRecordView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// SessionAudioRecordView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/21.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SessionAudioRecordView : UIView
|
||||
|
||||
- (void)configAudioRecord:(NSString *)imageName title:(NSString *)title isAnimation:(BOOL)isAnimation;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
108
xplan-ios/Main/Message/View/Session/SessionAudioRecordView.m
Normal file
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// SessionAudioRecordView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/21.
|
||||
//
|
||||
|
||||
#import "SessionAudioRecordView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
|
||||
@interface SessionAudioRecordView ()
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView * backView;
|
||||
///显示图片
|
||||
@property (nonatomic,strong) UIImageView *logoImageView;
|
||||
///显示标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
@end
|
||||
|
||||
@implementation SessionAudioRecordView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Public Method
|
||||
- (void)configAudioRecord:(NSString *)imageName title:(NSString *)title isAnimation:(BOOL)isAnimation {
|
||||
self.logoImageView.image = [UIImage imageNamed:imageName];
|
||||
if (isAnimation) {
|
||||
[self.logoImageView startAnimating];
|
||||
} else {
|
||||
[self.logoImageView stopAnimating];
|
||||
}
|
||||
self.titleLabel.text = title;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.backView];
|
||||
[self.backView addSubview:self.logoImageView];
|
||||
[self.backView addSubview:self.titleLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(250, 200));
|
||||
}];
|
||||
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.backView);
|
||||
make.top.mas_equalTo(self.backView).offset(50);
|
||||
make.size.mas_equalTo(CGSizeMake(90, 72));
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView);
|
||||
make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(25);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.backgroundColor = [UIColor blackColor];
|
||||
_backView.layer.masksToBounds = YES;
|
||||
_backView.layer.cornerRadius = 10;
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
|
||||
- (UIImageView *)logoImageView {
|
||||
if (!_logoImageView) {
|
||||
_logoImageView = [[UIImageView alloc] init];
|
||||
_logoImageView.userInteractionEnabled = YES;
|
||||
UIImage *firstImage = [UIImage imageNamed:@"message_tool_audio_record_first"];
|
||||
UIImage *secondImage = [UIImage imageNamed:@"message_tool_audio_record_second"];
|
||||
UIImage *thirdImage = [UIImage imageNamed:@"message_tool_audio_record_third"];
|
||||
_logoImageView.animationImages = @[firstImage, secondImage, thirdImage];
|
||||
_logoImageView.animationDuration = 1;
|
||||
_logoImageView.animationRepeatCount = HUGE;
|
||||
}
|
||||
return _logoImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -15,6 +15,7 @@
|
||||
#import "MessageMenuModel.h"
|
||||
///View
|
||||
#import "MessageToolMenuCollectionViewCell.h"
|
||||
#import "SessionAudioRecordView.h"
|
||||
|
||||
#define TOOL_HEIGHT 60
|
||||
#define MENU_HEIGHT 130
|
||||
@@ -42,6 +43,8 @@
|
||||
@property (nonatomic,strong) UIView * placeView;
|
||||
///菜单数据
|
||||
@property (nonatomic,strong) NSArray<MessageMenuModel *> *menuList;
|
||||
///录音的view
|
||||
@property (nonatomic,strong) SessionAudioRecordView *audioRecordView;
|
||||
@end
|
||||
|
||||
@implementation SessionToolbarView
|
||||
@@ -50,6 +53,7 @@
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self addNotification];
|
||||
[self addAudioButtonAction];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
@@ -66,6 +70,15 @@
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)addAudioButtonAction {
|
||||
///button 周围有一个70px的范围 超出这个范围的话 就是out 在这个范围的话就是in 从范围外到范围内的话就是enter 从范围内到范围外的话exit
|
||||
[self.audioButton addTarget:self action:@selector(audioTouchDownAction) forControlEvents:UIControlEventTouchDown];
|
||||
[self.audioButton addTarget:self action:@selector(audioTouchUpOutsideAction) forControlEvents:UIControlEventTouchUpOutside];
|
||||
[self.audioButton addTarget:self action:@selector(audioTouchUpInsideAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.audioButton addTarget:self action:@selector(audioTouchDragEnterAction) forControlEvents:UIControlEventTouchDragEnter];
|
||||
[self.audioButton addTarget:self action:@selector(audioTouchDragExitAction) forControlEvents:UIControlEventTouchDragExit];
|
||||
}
|
||||
|
||||
- (void)addNotification {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
|
||||
@@ -232,6 +245,43 @@
|
||||
|
||||
}
|
||||
|
||||
- (void)audioTouchDownAction {
|
||||
///开始录音
|
||||
NSLog(@"UIControlEventTouchDown");
|
||||
if (!self.audioRecordView.superview) {
|
||||
[[UIApplication sharedApplication].keyWindow addSubview:self.audioRecordView];
|
||||
[self.audioRecordView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.audioRecordView.superview);
|
||||
}];
|
||||
[self.audioRecordView configAudioRecord:@"message_tool_audio_record_first" title:@"手指上滑,取消发送" isAnimation:YES];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)audioTouchUpOutsideAction {
|
||||
///取消录音
|
||||
NSLog(@"UIControlEventTouchUpOutside");
|
||||
[self.audioRecordView removeFromSuperview];
|
||||
}
|
||||
|
||||
- (void)audioTouchUpInsideAction {
|
||||
///手指抬起 完成录音
|
||||
NSLog(@"UIControlEventTouchUpInside");
|
||||
[self.audioRecordView removeFromSuperview];
|
||||
}
|
||||
|
||||
- (void)audioTouchDragEnterAction {
|
||||
///手指上滑 取消发送
|
||||
NSLog(@"UIControlEventTouchDragEnter");
|
||||
[self.audioRecordView configAudioRecord:@"message_tool_audio_record_first" title:@"手指上滑,取消发送" isAnimation:YES];
|
||||
}
|
||||
|
||||
- (void)audioTouchDragExitAction {
|
||||
///松开手指 取消发送
|
||||
NSLog(@"UIControlEventTouchDragExit");
|
||||
[self.audioRecordView configAudioRecord:@"message_tool_audio_record_cancel" title:@"松开手指 取消发送" isAnimation:NO];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setSendDisabled:(BOOL)sendDisabled {
|
||||
self.userInteractionEnabled = !sendDisabled;
|
||||
@@ -318,8 +368,9 @@
|
||||
if (!_audioButton) {
|
||||
_audioButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_audioButton setTitle:@"按住说话" forState:UIControlStateNormal];
|
||||
[_audioButton setTitle:@"松开结束" forState:UIControlStateSelected];
|
||||
[_audioButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
_audioButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightBold];
|
||||
_audioButton.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_audioButton.layer.masksToBounds = YES;
|
||||
_audioButton.layer.cornerRadius = 17;
|
||||
_audioButton.backgroundColor = UIColorFromRGB(0xF1F1FA);
|
||||
@@ -379,7 +430,12 @@
|
||||
return _menuList;
|
||||
}
|
||||
|
||||
|
||||
- (SessionAudioRecordView *)audioRecordView {
|
||||
if (!_audioRecordView) {
|
||||
_audioRecordView = [[SessionAudioRecordView alloc] init];
|
||||
}
|
||||
return _audioRecordView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|