修改立刻清空出现延迟时间

This commit is contained in:
2025-12-19 18:14:28 +08:00
parent fc65052583
commit d90e080981

View File

@@ -17,7 +17,7 @@
static const NSTimeInterval kKBBackspaceLongPressMinDuration = 0.35;
static const NSTimeInterval kKBBackspaceRepeatInterval = 0.06;
static const NSTimeInterval kKBBackspaceChunkStartDelay = 1.0;
static const NSTimeInterval kKBBackspaceChunkStartDelay = 0.1;
static const NSTimeInterval kKBBackspaceChunkRepeatInterval = 0.1;
static const NSTimeInterval kKBBackspaceChunkFastDelay = 1.4;
static const NSInteger kKBBackspaceChunkSize = 6;
@@ -926,6 +926,7 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
if (label.hidden) {
label.alpha = 0.0;
label.hidden = NO;
[self kb_playLightHaptic];
[UIView animateWithDuration:0.12 animations:^{
label.alpha = 1.0;
}];
@@ -987,6 +988,14 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
return t.accentColor ?: t.keyHighlightBackground ?: [UIColor colorWithWhite:0.8 alpha:1.0];
}
- (void)kb_playLightHaptic {
if (@available(iOS 10.0, *)) {
UIImpactFeedbackGenerator *gen = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight];
[gen prepare];
[gen impactOccurred];
}
}
- (UILabel *)backspaceClearLabel {
if (!_backspaceClearLabel) {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];