Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
http://qmuiteam.com/ios
Other
7.05k stars 1.37k forks source link

NavBarRemoveBackgroundEffectAutomatically 在开启了 AutomaticCustomNavigationBarTransitionStyle 时可能对假 bar 无效 #1330

Closed dongq0916 closed 2 years ago

dongq0916 commented 2 years ago

Bug 表现 iOS 15返回的导航动画上一个界面会有白色透明的遮罩,返回完成时消失 iOS 14以下正常

截图

https://user-images.githubusercontent.com/12602855/144188140-179bd2cc-652f-46d9-8a65-fb7dc88d7840.mov

如何重现

  1. A界面设置导航透明 push到导航不透明的B界面
  2. 返回时(包括手势返回)A界面导航上会有白色透明遮罩

预期的表现 返回时(包括手势返回)A界面导航上无白色透明遮罩

其他信息

MoLice commented 2 years ago

录屏好像没内容?

dongq0916 commented 2 years ago

不好意思 这边直接上传好像有问题
我直接给录屏链接了 https://ewhj.oss-cn-shanghai.aliyuncs.com/RPReplay_Final1638342477.mov

MoLice commented 2 years ago

使用 4.4.0 是否有打开这个开关? image

dongq0916 commented 2 years ago

开了 image

MoLice commented 2 years ago

使用最新 QMUI Demo 测试,未发现该问题。

image

配置表打开 AutomaticCustomNavigationBarTransitionStyle 的录屏,切换界面时导航栏分成左右两段,互不干扰。

dongq0916 commented 2 years ago

这边简单写个了demo 还是能够复现这个问题 QMUIDemo.zip

MoLice commented 2 years ago

该问题是因为 NavBarRemoveBackgroundEffectAutomatically 开关对于转场动画过程中的 _QMUITransitionNavigationBar,会命中 UINavigationBar+QMUI.m 228 行的 if (!selfObject.superview) return;,然后后续也没人再触发 - [_UIBarBackground updateBackground] 了,导致 _QMUITransitionNavigationBarNavBarRemoveBackgroundEffectAutomatically 开关无效。在 QMUI 修复该问题之前,请在本地的 @implementation _QMUITransitionNavigationBar 里添加如下代码:

- (void)didAddSubview:(UIView *)subview {
    [super didAddSubview:subview];
    if (subview == self.qmui_backgroundView) {
        [subview qmui_performSelector:NSSelectorFromString(@"updateBackground") withArguments:nil];
    }
}
Snail-hash commented 2 years ago

在4.4.0Demo中修改QMUICMI.automaticCustomNavigationBarTransitionStyle = YES;

@implementation _QMUITransitionNavigationBar 中添加

QMUIDemo_iOS-master.zip

入口:Lab标签 -> NavBarHidden

MoLice commented 2 years ago

@Snail-hash 你说的是另一个问题,查看 #1335

MoLice commented 2 years ago

已发布 4.4.1 修复该问题。

MoLice commented 2 years ago

已发布 4.4.1 修复该问题。

不好意思,这个代码忘了带上 4.4.1,近期会再发个 4.4.2 补上

MoLice commented 2 years ago

已发布 4.4.2 修复该问题。