处理ios18从其他app用自己键盘 拉起主app的bug
其他问题
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user