修改引导逻辑
This commit is contained in:
@@ -46,7 +46,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
||||
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.left.right.equalTo(self.view);
|
||||
make.bottom.equalTo(self.inputBar.mas_top);
|
||||
make.bottom.equalTo(self.view);
|
||||
}];
|
||||
|
||||
[self.inputBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -108,22 +108,23 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
||||
|
||||
[self kb_preparePermissionOverlayIfNeeded];
|
||||
BOOL show = needGuide;
|
||||
[UIView performWithoutAnimation:^{
|
||||
// [UIView performWithoutAnimation:^{
|
||||
self.permVC.view.hidden = !show;
|
||||
}];
|
||||
// }];
|
||||
}
|
||||
|
||||
/// 提前创建权限引导页覆盖层(仅一次)
|
||||
- (void)kb_preparePermissionOverlayIfNeeded {
|
||||
if (self.permVC) return;
|
||||
KBPermissionViewController *guide = [KBPermissionViewController new];
|
||||
guide.modalPresentationStyle = UIModalPresentationFullScreen; // 仅用于内部布局,不会真正 present
|
||||
// guide.modalPresentationStyle = UIModalPresentationFullScreen; // 仅用于内部布局,不会真正 present
|
||||
KBWeakSelf;
|
||||
guide.backHandler = ^{ [weakSelf.navigationController popViewControllerAnimated:YES]; };
|
||||
self.permVC = guide;
|
||||
guide.backButton.hidden = true;
|
||||
[self addChildViewController:guide];
|
||||
[self.view addSubview:guide.view];
|
||||
[guide.view mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.view); }];
|
||||
// [guide.view mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.view); }];
|
||||
[guide didMoveToParentViewController:self];
|
||||
guide.view.hidden = YES; // 初始隐藏
|
||||
}
|
||||
@@ -172,12 +173,10 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
||||
self.inputBarBottom.offset = offset;
|
||||
|
||||
[UIView animateWithDuration:duration delay:0 options:curve animations:^{
|
||||
[self.view layoutIfNeeded];
|
||||
// 留出输入栏高度的 contentInset,避免最后一行被遮挡
|
||||
UIEdgeInsets inset = self.tableView.contentInset;
|
||||
inset.bottom = 52 + MAX(kbHeight - safeBtm, 0);
|
||||
self.tableView.contentInset = inset;
|
||||
self.tableView.scrollIndicatorInsets = inset;
|
||||
// self.tableView.scrollIndicatorInsets = inset;
|
||||
} completion:^(BOOL finished) {
|
||||
[self scrollToBottomAnimated:YES];
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user