移动文件

This commit is contained in:
2025-10-29 16:44:00 +08:00
parent 9101ffaab0
commit c5326a3079
9 changed files with 71 additions and 10 deletions

View File

@@ -16,12 +16,13 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
KBGuideItemTypeKF //
};
@interface KBGuideVC () <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate>
@interface KBGuideVC () <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, UIGestureRecognizerDelegate>
@property (nonatomic, strong) BaseTableView *tableView; // BaseTableView
@property (nonatomic, strong) UIView *inputBar; //
@property (nonatomic, strong) UITextField *textField; //
@property (nonatomic, strong) MASConstraint *inputBarBottom;//
@property (nonatomic, strong) UITapGestureRecognizer *bgTap;//
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *items; // [{type, text}]
@@ -41,7 +42,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.view);
make.bottom.equalTo(self.view);
make.bottom.equalTo(self.inputBar.mas_top);
}];
[self.inputBar mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -68,12 +69,23 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
//
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(kb_keyboardWillChange:) name:UIKeyboardWillChangeFrameNotification object:nil];
// cell /
self.bgTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(kb_didTapBackground)];
self.bgTap.cancelsTouchesInView = NO;
self.bgTap.delegate = self;
[self.tableView addGestureRecognizer:self.bgTap];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)kb_didTapBackground {
//
[self.view endEditing:YES];
}
#pragma mark - Actions
@@ -224,4 +236,21 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
return _items;
}
#pragma mark - UIGestureRecognizerDelegate
//
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if (gestureRecognizer == self.bgTap) {
if ([touch.view isDescendantOfView:self.inputBar]) {
return NO;
}
}
return YES;
}
// /
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
@end