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

无法屏蔽 QMUI 配置表设置的 navigationBar 样式对 MFMailComposeViewController 的影响 #683

Closed
insist159 opened this issue Aug 28, 2019 · 12 comments

Comments

@insist159
Copy link

我使用配置文件配置导航颜色,但是影响了一些系统提供的功能页面,比如说ABPeoplePickerNavigationController 等等

@MoLice
Copy link
Collaborator

MoLice commented Aug 29, 2019

影响到系统所有 navigationBar 的原因是因为 QMUI 配置表里的 navBarXxx 系列属性是通过 UINavigationBar.appearance.xxx = xxx 的方式来设置的(源码请查看 QMUIConfiguration.m),但由于系统只提供了 appearanceWhenContainedInInstancesOfClasses: 来限定在某些 class 里才让 appearance 生效,却没提供类似 appearanceWhenNotContainedInXxx 的方法,所以我们无法单独屏蔽对某些系统 class 的 navigationBar 的影响。

建议这种情况可以手动在业务项目里添加以下代码将指定系统的 class 的 navigationBar 样式重置回来:

UINavigationBar *barInABPeople = [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[ABPeoplePickerNavigationController class]];
barInABPeople.tintColor = nil;
barInABPeople.barTintColor = nil;
barInABPeople.xxx = xxx;
...

@insist159
Copy link
Author

好像不行啊

@insist159
Copy link
Author

还有一点,我是用生成图片的方式用于导航背景

@MoLice
Copy link
Collaborator

MoLice commented Sep 3, 2019

生成图片没关系的,也可以。是否能提供一个 Demo 看看?

@insist159
Copy link
Author

@MoLice
QMUIDemo.zip
Demo已奉上

@insist159
Copy link
Author

@MoLice

@insist159
Copy link
Author

@ziecho

@insist159
Copy link
Author

@MoLice

1 similar comment
@insist159
Copy link
Author

@MoLice

@MoLice
Copy link
Collaborator

MoLice commented Sep 19, 2019

这个 Demo 里有两个问题,一个是 QMUI 配置表的样式如何不影响系统其他框架的样式,另一个是 navigationBarTintColor 不生效。

后者是 QMUI 的 bug,由 #692 跟进,这里不详述。

前者是符合 QMUI 的设计预期的,也即整个 App 里样式都是统一的,不管调起的界面是属于系统的还是业务的,而如果业务项目需要更改这个规则也是可以的。但目前看来即便我们重置了 appearanceWhenContainedInInstancesOfClasses:@[MFMailComposeViewController.class] 的样式,MFMailComposeViewController 里的 navigationBar 依然走了默认的 appearance,,目前暂未找到优雅的方式解决这个问题,建议可以在 present 邮件界面前直接修改 UINavigationBar.appearance.barTintColor/tintColor/xxx,在退出邮件界面后恢复业务项目自己的 appearance 值。

后续我们再看如何优雅解决这个问题。

@insist159
Copy link
Author

@MoLice 好的 感谢

@MoLice MoLice changed the title 如何能屏蔽QMUINavigationController对系统提供的框架页面,比如说ABPeoplePickerNavigationController的影响 无法屏蔽 QMUI 配置表设置的 navigationBar 样式对 MFMailComposeViewController 的影响 Sep 20, 2019
@MoLice
Copy link
Collaborator

MoLice commented Sep 27, 2019

已发布 4.0.0 版本修复该问题。

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

No branches or pull requests

2 participants