Comments (5)
Code:
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *navigationBarAppearance = [UINavigationBarAppearance new];
navigationBarAppearance.backgroundColor = UIColor.white;
self.navigationController.navigationBar.scrollEdgeAppearance = navigationBarAppearance;
self.navigationController.navigationBar.standardAppearance = navigationBarAppearance;
}
from rtrootnavigationcontroller.
你好,请问有解决方案吗?
from rtrootnavigationcontroller.
Code:
if (@available(iOS 15.0, *)) { UINavigationBarAppearance *navigationBarAppearance = [UINavigationBarAppearance new]; navigationBarAppearance.backgroundColor = UIColor.white; self.navigationController.navigationBar.scrollEdgeAppearance = navigationBarAppearance; self.navigationController.navigationBar.standardAppearance = navigationBarAppearance; }
好用,谢谢
from rtrootnavigationcontroller.
这个问题应该由使用方自己处理,我无法处理所有场景,建议在启动时统一设置 appearance:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// setup appearance
if (@available(iOS 15.0, *)) {
[[UINavigationBar appearance] setScrollEdgeAppearance:({
UINavigationBarAppearance *app = [UINavigationBarAppearance new];
[app configureWithDefaultBackground];
// init app property
// app.backgroundColor = xxx; app.shadowColor = xxx;
app;
})];
} else {
// Fallback on earlier versions
}
return YES;
}
from rtrootnavigationcontroller.
if (@available(iOS 15.0, *)) { [[UINavigationBar appearance] setScrollEdgeAppearance:({ UINavigationBarAppearance *app = [UINavigationBarAppearance new]; [app configureWithDefaultBackground]; // init app property // app.backgroundColor = xxx; app.shadowColor = xxx; app; })]; } else { // Fallback on earlier versions }
iOS15 这样设置全局颜色后,某一页面想换导航栏颜色,怎么办
这个问题应该由使用方自己处理,我无法处理所有场景,建议在启动时统一设置 appearance:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // setup appearance if (@available(iOS 15.0, *)) { [[UINavigationBar appearance] setScrollEdgeAppearance:({ UINavigationBarAppearance *app = [UINavigationBarAppearance new]; [app configureWithDefaultBackground]; // init app property // app.backgroundColor = xxx; app.shadowColor = xxx; app; })]; } else { // Fallback on earlier versions } return YES; }
这个问题应该由使用方自己处理,我无法处理所有场景,建议在启动时统一设置 appearance:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // setup appearance if (@available(iOS 15.0, *)) { [[UINavigationBar appearance] setScrollEdgeAppearance:({ UINavigationBarAppearance *app = [UINavigationBarAppearance new]; [app configureWithDefaultBackground]; // init app property // app.backgroundColor = xxx; app.shadowColor = xxx; app; })]; } else { // Fallback on earlier versions } return YES; }
iOS15,这样设置全局导航栏颜色后,某一页面想换其他颜色,怎么办
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 3
- iOS15导航问题 HOT 5
- 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.