Comments (5)
if (@available(iOS 15.0, *)) { [[UINavigationBar appearance] setScrollEdgeAppearance:({ UINavigationBarAppearance *app = [UINavigationBarAppearance new]; [app configureWithDefaultBackground]; // init app property app.backgroundColor = UIColorHex(0x163a59); app.shadowColor = UIColorHex(0x163a59); app; })]; }
你好,根据这个配置颜色,如果vc里面有tableview,向上画一下就变成了白色,希望大佬能关注到这个问题
[UINavigationBar appearance].standardAppearance = app;
这个也配置一下就行了
from rtrootnavigationcontroller.
var setNavigationType: Int {
set {
if #available(iOS 15.0, *) {
if newValue == 0 {
let app = UINavigationBarAppearance.init()
app.configureWithDefaultBackground() /// 设置默认背景
app.backgroundImage = nil /// 导航条背景 : 一张图片
app.backgroundColor = JFTMainColor /// 导航条背景 : 纯颜色
app.backgroundEffect = nil /// 导航条背景 : 是否要一个 模糊效果
app.shadowImage = nil /// 导航条最下方的一条线 : 一张图片
app.shadowColor = UIColor.clear /// 导航条最下方的一条线 : 纯颜色
app.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white] /// 导航条title的颜色 || 大小
navigationController?.navigationBar.scrollEdgeAppearance = app
navigationController?.navigationBar.standardAppearance = app
}else {
}
} else {
if newValue == 0 { // 主颜色
navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.white ,NSAttributedString.Key.font : UIFont.systemFont(ofSize: 18)]
navigationController?.navigationBar.barTintColor = JFTMainColor
}else {
}
}
}
get {
return 0
}
}
针对iOS15.0以后 我的做法 : 在 基类控制器中 用一个 setNavigationType 来表示, 可以设置默认值
特殊的几个页面: 导航条背景是图片 || 导航条背景是其他颜色 || 导航条背景是透明色
这样继承这个 基类控制器就可以 通过设置 setNavigationType 来修改 当前导航条的背景了
from rtrootnavigationcontroller.
感谢
from rtrootnavigationcontroller.
[UINavigationBar appearance]
是全局设置,当存在个别页面需要隐藏导航栏时不适用。
从源码 RTRootNavigationController.m 的 188 行前后上下文分析,加入以下代码可以分开设置从而达到效果。
fix.md
from rtrootnavigationcontroller.
var setNavigationType: Int { set { if #available(iOS 15.0, *) { if newValue == 0 { let app = UINavigationBarAppearance.init() app.configureWithDefaultBackground() /// 设置默认背景 app.backgroundImage = nil /// 导航条背景 : 一张图片 app.backgroundColor = JFTMainColor /// 导航条背景 : 纯颜色 app.backgroundEffect = nil /// 导航条背景 : 是否要一个 模糊效果 app.shadowImage = nil /// 导航条最下方的一条线 : 一张图片 app.shadowColor = UIColor.clear /// 导航条最下方的一条线 : 纯颜色 app.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white] /// 导航条title的颜色 || 大小 navigationController?.navigationBar.scrollEdgeAppearance = app navigationController?.navigationBar.standardAppearance = app }else { } } else { if newValue == 0 { // 主颜色 navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.white ,NSAttributedString.Key.font : UIFont.systemFont(ofSize: 18)] navigationController?.navigationBar.barTintColor = JFTMainColor }else { } } } get { return 0 } }
针对iOS15.0以后 我的做法 : 在 基类控制器中 用一个 setNavigationType 来表示, 可以设置默认值 特殊的几个页面: 导航条背景是图片 || 导航条背景是其他颜色 || 导航条背景是透明色 这样继承这个 基类控制器就可以 通过设置 setNavigationType 来修改 当前导航条的背景了
666
from rtrootnavigationcontroller.
Related Issues (20)
- 屏幕下面的tabbar未隐藏。 HOT 1
- 关于iOS14的适配工作 HOT 2
- 横竖屏切换出现跟系统UINavigationController不一致的效果 HOT 3
- iOS14上面popToRoot有问题 HOT 5
- RTRootNavigationController和网易云信SDK一起使用会导致返回按钮消失,也无法设置。
- 不维护了???
- TabbarController跳转 HOT 1
- 关于自定义转场动画的疑问
- iOS 15上导航栏会变成白色 HOT 5
- 关于iOS 15适配 HOT 3
- iOS15 如果配置了全局的导航器背景,后面针对某一个导航器修改背景没有效果 HOT 6
- 与ZFPlayer一起使用的问题 HOT 2
- 设置背景色不起作用,闪一下变回白色 HOT 1
- [self.navigationController pushViewController:self animated:YES] HOT 1
- iOS 16 使用UIWindowSceneGeometryPreferencesIOS切换横竖屏无效 HOT 5
- Memory leak: RTContainerController, RTContainerNavigationController HOT 1
- Will this be more cumbersome?
- iOS16+ Carsh HOT 3
- pop gesture bug on RTL layout
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 rtrootnavigationcontroller.