This commit is contained in:
2025-11-10 21:33:00 +08:00
parent dc0c55c495
commit 9059a24637
9 changed files with 258 additions and 7 deletions

View File

@@ -18,7 +18,10 @@ NS_ASSUME_NONNULL_BEGIN
/// 根据文案计算自适应尺寸(高度固定,宽度随文本变化)
+ (CGSize)sizeForEmoji:(NSString *)emoji title:(NSString *)title;
/// 点击右上角减号回调(由外部设置)。
/// 回传当前 cell方便外部从列表中定位并处理删除。
@property (nonatomic, copy, nullable) void (^onMinusTapped)(KBMyKeyboardCell *cell);
@end
NS_ASSUME_NONNULL_END

View File

@@ -64,6 +64,11 @@
[self.minusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self.minusBadge);
}];
//
self.minusBadge.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapMinus)];
[self.minusBadge addGestureRecognizer:tap];
}
return self;
}
@@ -157,5 +162,13 @@
return _coverView;
}
@end
#pragma mark - Actions
// VC
- (void)didTapMinus {
if (self.onMinusTapped) {
self.onMinusTapped(self);
}
}
@end