添加键盘背景

This commit is contained in:
2025-11-04 21:01:46 +08:00
parent 3e2dc4bcb6
commit f43f94b94d
13 changed files with 528 additions and 15 deletions

View File

@@ -5,6 +5,7 @@
#import "KBKeyButton.h"
#import "KBKey.h"
#import "KBSkinManager.h"
@implementation KBKeyButton
@@ -16,10 +17,11 @@
}
- (void)applyDefaultStyle {
self.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold]; //
[self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[self setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
self.backgroundColor = [UIColor whiteColor];
self.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
KBSkinTheme *t = [KBSkinManager shared].current;
[self setTitleColor:t.keyTextColor forState:UIControlStateNormal];
[self setTitleColor:t.keyTextColor forState:UIControlStateHighlighted];
self.backgroundColor = t.keyBackground;
self.layer.cornerRadius = 6.0; //
self.layer.masksToBounds = NO;
self.layer.shadowColor = [UIColor colorWithWhite:0 alpha:0.1].CGColor; //
@@ -46,10 +48,11 @@
- (void)refreshStateAppearance {
// Shift/CapsLock
KBSkinTheme *t = [KBSkinManager shared].current;
if (self.isSelected) {
self.backgroundColor = [UIColor colorWithWhite:0.85 alpha:1.0];
self.backgroundColor = t.keyHighlightBackground ?: t.keyBackground;
} else {
self.backgroundColor = [UIColor whiteColor];
self.backgroundColor = t.keyBackground;
}
}