From 6bdd111a3a67ada479388c9fb13305b789c87a1d Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Thu, 20 Nov 2025 20:36:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8C=89=E4=B8=8B=E5=8E=BB?= =?UTF-8?q?=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomKeyboard/View/KBKeyButton.m | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CustomKeyboard/View/KBKeyButton.m b/CustomKeyboard/View/KBKeyButton.m index 64ee914..0d7bc73 100644 --- a/CustomKeyboard/View/KBKeyButton.m +++ b/CustomKeyboard/View/KBKeyButton.m @@ -63,12 +63,18 @@ - (void)setHighlighted:(BOOL)highlighted { [super setHighlighted:highlighted]; - // 简单按压反馈:选中态不改变透明度,避免和高亮态冲突 - if (self.isSelected) { - self.alpha = 1.0; - } else { - self.alpha = highlighted ? 0.2 : 1.0; - } + + // 按下时整体做一个等比缩放动画,不改背景色和透明度。 + // 这样无论是纯文字键还是整块皮肤图,都有统一的“按下”视觉反馈。 + NSLog(@"来了老弟====="); + CGFloat scale = highlighted ? 0.9 : 1.0; // 可根据手感微调 0.9~0.95 + [UIView animateWithDuration:0.08 + delay:0 + options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseOut + animations:^{ + self.transform = CGAffineTransformMakeScale(scale, scale); + } + completion:nil]; } - (void)setSelected:(BOOL)selected {