-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
iOS 14 Beta 6 开启 customNavigationBarTransitionKey 的情况下转场效果错误 #1081
Comments
你好,请问 |
UINavigationBar的一个系统私有方法 |
感谢!!! |
感恩! |
在 4.2.1 发布前,如需要,可将以下方法添加到 + (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// iOS 14 开启 customNavigationBarTransitionKey 的情况下转场效果错误
// https://github.com/Tencent/QMUI_iOS/issues/1081
if (@available(iOS 14.0, *)) {
OverrideImplementation([_QMUITransitionNavigationBar class], NSSelectorFromString([NSString stringWithFormat:@"_%@_%@", @"accessibility", @"navigationController"]), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
return ^UINavigationController *(_QMUITransitionNavigationBar *selfObject) {
if (selfObject.originalNavigationBar) {
BeginIgnorePerformSelectorLeaksWarning
return [selfObject.originalNavigationBar performSelector:originCMD];
EndIgnorePerformSelectorLeaksWarning
}
// call super
UINavigationController *(*originSelectorIMP)(id, SEL);
originSelectorIMP = (UINavigationController *(*)(id, SEL))originalIMPProvider();
UINavigationController *result = originSelectorIMP(selfObject, originCMD);
return result;
};
});
}
});
} |
4.2.0 最好各个版本测试一下,弹一闪😿 |
已发布 4.2.1 修复该问题。 |
@MoLice @Liaoworking |
我们后来用的其他方法解决的导航栏显示异常的问题, 这个库用的人很多,如果有问题的话应该有人会说,勇敢点~ |
Bug 表现
预期的表现
Bug 原因
——by tibbers
iOS 14 Beta 6 开始,UINavigationBar 无法直接初始化后使用,必须关联在某个 UINavigationController 里,否则内部的 subviews 不会被创建出来,而 QMUI customNavigationBarTransitionKey 的工作方式就是在转场时把原来的 bar 的背景去除,再创建两条假 bar 模拟前后两个界面的样式,由于这两条假 bar 没有关联的 UINavigationController,所以内部 subviews 为空,所以转场时可以看到整个顶部导航栏的背景都是空的。
暂时的修复方式是重写假 bar 的
_accessibility_navigationController
方法,返回原始 bar 的同名方法的值,这样系统就会认为假 bar 存在关联的 UINavigationController,表现就正常了。其他信息
The text was updated successfully, but these errors were encountered: