最后提交

This commit is contained in:
启星
2025-10-27 17:05:46 +08:00
parent 92de736c3f
commit 3f76f23cb0
19 changed files with 201 additions and 32 deletions

View File

@@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
-(void)didResignFirstResponder;
-(void)didBecomeFirstResponder;
@end
@interface QXDynamicCommentInputView : UIView

View File

@@ -9,6 +9,7 @@
@interface QXDynamicCommentInputView()<UITextFieldDelegate>
@property (nonatomic,strong)UICollectionView *collectionViwew;
@property (nonatomic,strong)UIView *bigBgView;
@property (nonatomic,strong)UIView *inputBgView;
@property (nonatomic,strong)UIView *inputShadowView;
@@ -62,7 +63,7 @@
self.textField = [[UITextField alloc] init];
self.textField.font = [UIFont systemFontOfSize:14];
self.textField.textColor = QXConfig.textColor;
self.textField.returnKeyType = UIReturnKeyDone;
self.textField.returnKeyType = UIReturnKeySend;
self.textField.delegate = self;
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:UIControlEventEditingChanged];
[self.inputBgView addSubview:self.textField];
@@ -95,7 +96,14 @@
}
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
if (self.textField.text.length == 0) {
showToast(@"内容不能为空");
return NO;
}
[textField resignFirstResponder];
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickSendWithText:model:)]) {
[self.delegate didClickSendWithText:self.textField.text model:self.model];
}
return YES;
}
-(void)textFieldDidEndEditing:(UITextField *)textField{
@@ -103,6 +111,11 @@
[self.delegate didResignFirstResponder];
}
}
-(void)textFieldDidBeginEditing:(UITextField *)textField{
if (self.delegate && [self.delegate respondsToSelector:@selector(didBecomeFirstResponder)]) {
[self.delegate didBecomeFirstResponder];
}
}
-(void)setModel:(QXDynamicCommentListModel *)model{
_model = model;
}
@@ -111,6 +124,10 @@
}
-(void)sendAction{
if (self.textField.text.length == 0) {
showToast(@"内容不能为空");
return;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickSendWithText:model:)]) {
[self.delegate didClickSendWithText:self.textField.text model:self.model];
}