处理ios18从其他app用自己键盘 拉起主app的bug

其他问题
This commit is contained in:
2025-11-24 19:58:19 +08:00
parent 8e93f8f86f
commit 15e37841bb
20 changed files with 264 additions and 88 deletions

View File

@@ -61,7 +61,7 @@
// Token
// [[KBAuthManager shared] saveAccessToken:@"TEST" refreshToken:nil expiryDate:[NSDate dateWithTimeIntervalSinceNow:3600] userIdentifier:nil];
[[KBAuthManager shared] signOut];
// [[KBAuthManager shared] signOut];
}
- (void)setupTabbarAppearance{

View File

@@ -138,6 +138,10 @@
_q1Label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_q1Label.textColor = [UIColor blackColor];
_q1Label.text = KBLocalized(@"What are you doing?");
//
_q1Label.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(kb_onTapQ1)];
[_q1Label addGestureRecognizer:tap];
}
return _q1Label;
}
@@ -148,8 +152,29 @@
_q2Label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_q2Label.textColor = [UIColor blackColor];
_q2Label.text = KBLocalized(@"I'm going to take a shower.");
//
_q2Label.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(kb_onTapQ2)];
[_q2Label addGestureRecognizer:tap];
}
return _q2Label;
}
///
- (void)kb_copyTextToPasteboard:(NSString *)text {
if (text.length == 0) { return; }
UIPasteboard.generalPasteboard.string = text;
[KBHUD showInfo:KBLocalized(@"Copy Success")];
}
///
- (void)kb_onTapQ1 {
[self kb_copyTextToPasteboard:self.q1Label.text];
}
///
- (void)kb_onTapQ2 {
[self kb_copyTextToPasteboard:self.q2Label.text];
}
@end

View File

@@ -50,7 +50,7 @@
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.cardImageView);
make.top.equalTo(self.cardImageView).offset(84);
make.top.equalTo(self.cardImageView).offset(KBFit(95));
}];
}

View File

@@ -44,7 +44,7 @@
make.centerY.equalTo(self.titleLabel);
make.right.equalTo(self).offset(-20);
make.height.mas_equalTo(34);
make.width.mas_greaterThanOrEqualTo(115);
make.width.mas_greaterThanOrEqualTo(110);
}];
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(26);
@@ -118,7 +118,7 @@
if (!_keyboardBtn) {
_keyboardBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_keyboardBtn setTitle:KBLocalized(@"My Keyboard") forState:UIControlStateNormal];
_keyboardBtn.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightSemibold];
_keyboardBtn.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightSemibold];
[_keyboardBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_keyboardBtn.backgroundColor = [UIColor colorWithHex:KBColorValue];
_keyboardBtn.layer.cornerRadius = 17;

View File

@@ -32,10 +32,10 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
self.view.backgroundColor = [UIColor whiteColor];
// self.title = @"My Skin"; //
self.kb_titleLabel.text = KBLocalized(@"My skin");
// Editor/Cancel 使 BaseViewController kb_rightButton
self.kb_rightButton.hidden = NO;
[self.kb_rightButton setTitle:@"Editor" forState:UIControlStateNormal];
[self.kb_rightButton setTitle:KBLocalized(@"Editor") forState:UIControlStateNormal];
[self.kb_rightButton removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
[self.kb_rightButton addTarget:self action:@selector(onToggleEdit) forControlEvents:UIControlEventTouchUpInside];
@@ -49,13 +49,14 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT);
make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view.mas_bottom);
make.bottom.equalTo(self.bottomView.mas_top);
}];
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
make.height.mas_equalTo(64);
make.bottom.equalTo(self.view.mas_bottom);
// 0
make.height.mas_equalTo(0);
}];
// LYEmptyView +
@@ -108,11 +109,21 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
self.editingMode = !self.editingMode;
//
[self.kb_rightButton setTitle:(self.isEditingMode ? @"Cancel" : @"Editor")
[self.kb_rightButton setTitle:(self.isEditingMode ? KBLocalized(@"Cancel") : KBLocalized(@"Editor"))
forState:UIControlStateNormal];
//
self.bottomView.hidden = !self.isEditingMode;
// bottomView
CGFloat targetHeight = self.isEditingMode ? (KB_SAFE_BOTTOM + 44.0) : 0.0;
//
self.bottomView.hidden = NO;
[self.bottomView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(targetHeight);
}];
[UIView animateWithDuration:0.25 animations:^{
[self.view layoutIfNeeded];
} completion:^(BOOL finished) {
self.bottomView.hidden = !self.isEditingMode;
}];
// /退
self.collectionView.allowsMultipleSelection = self.isEditingMode;
@@ -155,7 +166,8 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
- (void)updateBottomUI {
NSInteger count = self.collectionView.indexPathsForSelectedItems.count;
self.selectedLabel.text = [NSString stringWithFormat:@"Selected: %ld Skins", (long)count];
NSString *format = KBLocalized(@"my_skin_selected_count");
self.selectedLabel.text = [NSString stringWithFormat:format, (long)count];
BOOL enable = count > 0;
self.deleteButton.enabled = enable;
@@ -253,11 +265,12 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
[self.selectedLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_bottomView).offset(16);
make.centerY.equalTo(_bottomView);
// 64 32
make.centerY.equalTo(_bottomView.mas_top).offset(32);
}];
[self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(_bottomView).offset(-16);
make.centerY.equalTo(_bottomView);
make.centerY.equalTo(_bottomView.mas_top).offset(32);
make.width.mas_equalTo(92);
make.height.mas_equalTo(36);
}];
@@ -270,7 +283,7 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
_selectedLabel = [UILabel new];
_selectedLabel.textColor = [UIColor colorWithHex:0x666666];
_selectedLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_selectedLabel.text = @"Selected: 0 Skins";
// _selectedLabel.text = @"Selected: 0 Skins";
}
return _selectedLabel;
}
@@ -278,7 +291,7 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
- (UIButton *)deleteButton {
if (!_deleteButton) {
_deleteButton = [UIButton buttonWithType:UIButtonTypeSystem];
[_deleteButton setTitle:@"Delete" forState:UIControlStateNormal];
[_deleteButton setTitle:KBLocalized(@"Delete") forState:UIControlStateNormal];
_deleteButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_deleteButton.layer.cornerRadius = 18;
_deleteButton.layer.borderWidth = 1;

View File

@@ -18,8 +18,10 @@
#define KB_UL_BASE @"https://your.domain/ul"
#endif
#define KB_UL_LOGIN KB_UL_BASE @"/login"
#define KB_UL_SETTINGS KB_UL_BASE @"/settings"
#define KB_UL_LOGIN KB_UL_BASE @"/login"
#define KB_UL_SETTINGS KB_UL_BASE @"/settings"
// 充值入口的通用链接:当前复用 /login 路径,通过 query 区分(避免额外配置 AASA 路径)
#define KB_UL_RECHARGE KB_UL_LOGIN
#endif /* KBConfig_h */