QMUI_iOS icon indicating copy to clipboard operation
QMUI_iOS copied to clipboard

_QMUITransitionNavigationBar UI样式错误

Open fanyuecheng opened this issue 1 year ago • 1 comments

Bug 表现 _QMUITransitionNavigationBar 样式错误

截图 Aug-12-2022 14-37-36

如何重现 QMUIDemo “优化导航栏在转场时的样式 ” 多次点击不同样式跳转后,返回会发现 从 “默认”到“深色”的过程中,“深色”vc的假导航栏是“默认”的蓝色,pop完成后,“深色”vc的假导航栏移除,显示了原本的灰色。

预期的表现 正常情况下,深色vc的假导航栏应该是灰色

其他信息

  • 设备: 模拟器
  • iOS 版本: [iOS 14.5]
  • Xcode 版本: [Xcode 12 13.4.1]
  • QMUI 版本: [4.5.0]

fanyuecheng avatar Aug 12 '22 06:08 fanyuecheng

好像是pop时, addTransitionNavigationBarAndBindNavigationBar: -> [self.view addSubview:customBar] -> [UINavigationBar _didMoveFromWindow:toWindow:] -> setBackgroundImage:forBarPosition:barMetrics:UINavigationBar+QMUI 中重写了 setBackgroundImage:forBarPosition:barMetrics: 并在其中为 appearance.backgroundImage 赋值,同时将该 appearance 赋值给navigationBar。 这个image一直是[UIImage qmui_imageWithThemeManagerName:QMUIThemeManagerNameDefault provider:provider] 就在这时候,appearance错误的赋值给了_QMUITransitionNavigationBar。 但是正在消失的vc好像就不会触发这些操作,仅正在出现的vc才会有。 同时不知道

copyStylesToBar.standardAppearance = self.standardAppearance; 
copyStylesToBar.scrollEdgeAppearance = self.scrollEdgeAppearance;

为什么没起作用

我在重写的这个方法syncAppearance前加了判断,不知是否有问题。

if ([selfObject isKindOfClass:NSClassFromString(@"_QMUITransitionNavigationBar")]) {  
     return;  
}  
syncAppearance(selfObject, ^void(UINavigationBarAppearance *appearance) {  
     appearance.backgroundImage = image;  
});

fanyuecheng avatar Aug 12 '22 08:08 fanyuecheng

已发布 4.5.1 修复该问题。

MoLice avatar Aug 25 '22 06:08 MoLice