Comments (3)
我看标题是可以正常响应的,但是leftBtn和rightBtn会很奇怪,有的时候能响应,有的时候不能响应。
可以提供一下暗黑模式下您对ZXNavigationBar属性设置的代码吗,感谢!
from zxnavigationbar.
现在我是在暗黑模式切换的通知里面,重新设置了一下左右按钮的颜色。
- (void)handleThemeDidChangeNotification:(NSNotification *)notification {
self.zx_navLeftBtn.zx_imageColor = self.zx_navTintColor;
self.zx_navRightBtn.zx_imageColor = self.zx_navTintColor;
self.zx_navSubRightBtn.zx_imageColor = self.zx_navTintColor;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.zx_navStatusBarStyle = ZXNavStatusBarStyleDefault;
self.view.backgroundColor = UIColor.qd_backgroundColor;
self.zx_navBar.backgroundColor = UIColor.qd_backgroundColor;
self.zx_navTintColor = [UIColor qmui_colorWithThemeProvider:^UIColor * _Nonnull(__kindof QMUIThemeManager * _Nonnull manager, __kindof NSObject<NSCopying> * _Nullable identifier, __kindof NSObject * _Nullable theme) {
if ([identifier isEqual:QDThemeIdentifierDark]) {
return [UIColor whiteColor];
} else {
return [UIColor darkGrayColor];
}
}];
self.zx_navBar.lineView.hidden = YES;
self.zx_navLeftBtn.zx_imageColor = self.zx_navTintColor;
self.zx_navRightBtn.zx_imageColor = self.zx_navTintColor;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleThemeDidChangeNotification:) name:QMUIThemeDidChangeNotification object:nil];
}
from zxnavigationbar.
现在我是在暗黑模式切换的通知里面,重新设置了一下左右按钮的颜色。
- (void)handleThemeDidChangeNotification:(NSNotification *)notification { self.zx_navLeftBtn.zx_imageColor = self.zx_navTintColor; self.zx_navRightBtn.zx_imageColor = self.zx_navTintColor; self.zx_navSubRightBtn.zx_imageColor = self.zx_navTintColor; }
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.zx_navStatusBarStyle = ZXNavStatusBarStyleDefault; self.view.backgroundColor = UIColor.qd_backgroundColor; self.zx_navBar.backgroundColor = UIColor.qd_backgroundColor; self.zx_navTintColor = [UIColor qmui_colorWithThemeProvider:^UIColor * _Nonnull(__kindof QMUIThemeManager * _Nonnull manager, __kindof NSObject<NSCopying> * _Nullable identifier, __kindof NSObject * _Nullable theme) { if ([identifier isEqual:QDThemeIdentifierDark]) { return [UIColor whiteColor]; } else { return [UIColor darkGrayColor]; } }]; self.zx_navBar.lineView.hidden = YES; self.zx_navLeftBtn.zx_imageColor = self.zx_navTintColor; self.zx_navRightBtn.zx_imageColor = self.zx_navTintColor; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleThemeDidChangeNotification:) name:QMUIThemeDidChangeNotification object:nil]; }
您好,感谢您的协助,self.zx_navTintColor
用于设置导航栏标题文字颜色+左右按钮图片颜色+左右按钮文字颜色,也就是说,您通过设置self.zx_navTintColor = [UIColor redColor]
即可将导航栏标题颜色和左右按钮图片颜色设置为红色,self.zx_navLeftBtn.zx_imageColor
用户在此基础上,覆盖设置颜色(比如需要将左侧按钮图片颜色单独设置成黄色),因此根据您的需求,您只需要作以下调整即可:
- (void)handleThemeDidChangeNotification:(NSNotification *)notification {
//如果是暗黑模式
self.zx_navTintColor = 暗黑模式下的颜色;
//如果不是暗黑模式
self.zx_navTintColor = 普通模式下的颜色;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//默认是ZXNavStatusBarStyleDefault,如果全局都是ZXNavStatusBarStyleDefault,这一行也可以去掉
//self.zx_navStatusBarStyle = ZXNavStatusBarStyleDefault;
self.view.backgroundColor = UIColor.qd_backgroundColor;
self.zx_navBar.backgroundColor = UIColor.qd_backgroundColor;
self.zx_navTintColor = [UIColor qmui_colorWithThemeProvider:^UIColor * _Nonnull(__kindof QMUIThemeManager * _Nonnull manager, __kindof NSObject<NSCopying> * _Nullable identifier, __kindof NSObject * _Nullable theme) {
if ([identifier isEqual:QDThemeIdentifierDark]) {
return [UIColor whiteColor];
} else {
return [UIColor darkGrayColor];
}
}];
self.zx_navBar.lineView.hidden = YES;
//以下两行代码不需要设置,可以去掉
//self.zx_navLeftBtn.zx_imageColor = self.zx_navTintColor;
//self.zx_navRightBtn.zx_imageColor = self.zx_navTintColor;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleThemeDidChangeNotification:) name:QMUIThemeDidChangeNotification object:nil];
}
您可以根据上述事例调整一下您的代码,若有任何问题欢迎随时在issue中回复我,感谢!
from zxnavigationbar.
Related Issues (20)
- 如何增大backButton的触发面积. HOT 1
- 我想在当前页面禁止pop手势,或者是拦截返回手势,设置以下无效, HOT 2
- 提个建议 HOT 1
- BackButtonHandlerProtocol 协议名重复 HOT 1
- 设置状态栏颜色不管事怎么解决 HOT 9
- TableViewController的显示有问题。 HOT 2
- 请问侧滑返回能增加像系统导航那种渐变吗 HOT 1
- TableViewController还是有比较严重的问题 HOT 2
- 能不能ZXNavigationBarController加个分类,就是不继承它,也可以使用相关的属性 HOT 1
- safeArea布局问题
- zx_setPopGestureCompatibleScrollView返回手势冲突解决问题 HOT 3
- 如果viewcontroller里面并排两个tableview,第二个tableview就会到导航栏下面去了 HOT 1
- 可以适配RTL吗
- self.zx_navBar.zx_y = 200;发现无法改变zx_navBar的位置
- 好像对TableViewController失效了 HOT 3
- 写的很好哦 HOT 1
- 请问现在有适配iOS 15了么?
- 麻烦适配下iOS 13的一些属性获取,比如keyWindow,statusBarFrame这些 HOT 1
- IQKeyboardManager冲突 HOT 1
- It looks very convenient, but I don't know how to use it HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zxnavigationbar.