Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 UISearchController 配合 qmui_usedAsTableHeaderView,在进入搜索时能看到 QMUIConsole 闪过 #743

Closed
RomanticEncounter opened this issue Sep 30, 2019 · 2 comments
Labels

Comments

@RomanticEncounter
Copy link

Bug 表现
使用UISearchController配合qmui_usedAsTableHeaderView使用后,第一次点击searchbar蒙版动画的错误

截图
Bug 现场的界面截图,或者 Xcode 控制台的错误信息截图,有问题的代码截图
image

如何重现
使用懒加载
image

预期的表现
正常应是若隐

其他信息

  • 设备: [模拟器iPhone 11 、真机iPhone 7 Plus]
  • iOS 版本: [iOS 13.0、iOS 13.1.1]
  • Xcode 版本: [Xcode 11.0]
  • QMUI 版本: [4.0.0]
@MoLice MoLice added the bug label Sep 30, 2019
@MoLice
Copy link
Collaborator

MoLice commented Sep 30, 2019

这个问题是因为 UISearchBar 系统默认的背景图命中了 UIImage (QMUI) 里对 resizableImageWithCapInsets 的检测,所以当你进入搜索时,QMUIConsole 会显示出来,而此时正在做搜索框的升起动画,于是 QMUIConsole 内部的 window.hidden = NO 也被以动画的形式展示出来,于是你会看到一个黑色半透明的东西从左上角展开,那其实是 QMUIConsole 里的 window,不是 UISearchController 的 dimmingView。

由于 QMUIConsole 只会在 Debug 下显示,所以这个问题不影响 Release 的包。内部版本我们已对此做了调整,你也可以将以下代码覆盖到本地的 QMUIConsole.m 中:

+ (void)show {
    QMUIConsole *console = [QMUIConsole sharedInstance];
    if (console.canShow) {
        
        if (!console.consoleWindow.hidden) return;
        
        // 在某些情况下 show 的时候刚好界面正在做动画,就可能会看到 consoleWindow 从左上角展开的过程(window 默认背景色是黑色的),所以这里做了一些小处理
        // https://github.com/Tencent/QMUI_iOS/issues/743
        [UIView performWithoutAnimation:^{
            [console initConsoleWindowIfNeeded];
            console.consoleWindow.alpha = 0;
            console.consoleWindow.hidden = NO;
        }];
        [UIView animateWithDuration:.25 delay:.2 options:QMUIViewAnimationOptionsCurveOut animations:^{
            console.consoleWindow.alpha = 1;
        } completion:nil];
    }
}

@MoLice MoLice changed the title 使用UISearchController配合qmui_usedAsTableHeaderView使用后蒙版动画的错误 使用 UISearchController 配合 qmui_usedAsTableHeaderView,在进入搜索时能看到 QMUIConsole 闪过 Sep 30, 2019
@MoLice
Copy link
Collaborator

MoLice commented Oct 12, 2019

已发布 4.0.2 修复该问题。

@MoLice MoLice closed this as completed Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants