Skip to content

Commit fb1c109

Browse files
sumengsumeng
authored andcommitted
fix bug
1 parent b9cde96 commit fb1c109

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

2.29 KB
Loading

Coding_iOS/Views/UIMessageInputView/UIMessageInputView.m

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ @interface UIMessageInputView () <AGEmojiKeyboardViewDelegate, AGEmojiKeyboardVi
4646

4747
@property (strong, nonatomic) UIScrollView *contentView;
4848
@property (strong, nonatomic) UIPlaceHolderTextView *inputTextView;
49-
@property (strong, nonatomic) UIImageView *arrowKeyboardView;
49+
@property (strong, nonatomic) UIButton *arrowKeyboardButton;
5050

5151
@property (strong, nonatomic) UICustomCollectionView *mediaView;
5252
@property (strong, nonatomic) NSMutableArray *mediaList, *uploadMediaList;
@@ -118,8 +118,8 @@ - (void)setInputState:(UIMessageInputViewState)inputState{
118118
break;
119119
}
120120
_contentView.hidden = _inputState == UIMessageInputViewStateVoice;
121-
_arrowKeyboardView.hidden = !_contentView.hidden;
122-
_arrowKeyboardView.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
121+
_arrowKeyboardButton.hidden = !_contentView.hidden;
122+
_arrowKeyboardButton.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
123123
}
124124
}
125125
- (void)setPlaceHolder:(NSString *)placeHolder{
@@ -531,11 +531,14 @@ - (void)customUIWithType:(UIMessageInputViewContentType)type{
531531
}
532532
_voiceButton.hidden = !hasVoiceBtn;
533533

534-
if (hasVoiceBtn && !_arrowKeyboardView) {
535-
_arrowKeyboardView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"keyboard_arrow_down"]];
536-
[self addSubview:_arrowKeyboardView];
534+
if (hasVoiceBtn && !_arrowKeyboardButton) {
535+
_arrowKeyboardButton = [UIButton buttonWithType:UIButtonTypeCustom];
536+
_arrowKeyboardButton.frame = CGRectMake(0, 0, kMessageInputView_Width_Tool, kMessageInputView_Width_Tool);
537+
[_arrowKeyboardButton setImage:[UIImage imageNamed:@"keyboard_arrow_down"] forState:UIControlStateNormal];
538+
[_arrowKeyboardButton addTarget:self action:@selector(arrowButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
539+
[self addSubview:_arrowKeyboardButton];
537540
}
538-
_arrowKeyboardView.hidden = YES;
541+
_arrowKeyboardButton.hidden = YES;
539542

540543
if (hasVoiceBtn && !_voiceKeyboardView) {
541544
_voiceKeyboardView = [[UIMessageInputView_Voice alloc] initWithFrame:CGRectMake(0, kScreen_Height, kScreen_Width, kKeyboardView_Height)];
@@ -763,6 +766,10 @@ - (void)voiceButtonClicked:(id)sender {
763766
}
764767
}
765768

769+
- (void)arrowButtonClicked:(id)sender {
770+
[self isAndResignFirstResponder];
771+
}
772+
766773
#pragma mark QBImagePickerControllerDelegate
767774
- (void)qb_imagePickerController:(QBImagePickerController *)imagePickerController didSelectAssets:(NSArray *)assets{
768775

Coding_iOS/Views/UIMessageInputView/UIMessageInputView_Voice.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ - (void)setState:(UIMessageInputView_VoiceState)state {
9999
if (state == UIMessageInputView_VoiceStateRecording) {
100100
_volumeLeftView.center = CGPointMake(_recordTipsLabel.frame.origin.x - _volumeLeftView.frame.size.width/2 - 12, _recordTipsLabel.center.y);
101101
_volumeLeftView.hidden = NO;
102-
_volumeRightView.center = CGPointMake(_recordTipsLabel.frame.origin.x + _recordTipsLabel.frame.size.width + _recordTipsLabel.frame.size.width/2 + 12, _recordTipsLabel.center.y);
102+
_volumeRightView.center = CGPointMake(_recordTipsLabel.frame.origin.x + _recordTipsLabel.frame.size.width + _volumeRightView.frame.size.width/2 + 12, _recordTipsLabel.center.y);
103103
_volumeRightView.hidden = NO;
104104
}
105105
}

0 commit comments

Comments
 (0)