导航栏与视图相同的bg颜色 [英] Navigation bar same bg color as view

查看:144
本文介绍了导航栏与视图相同的bg颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的设计师希望导航栏具有与视图相同的背景颜色。但是,他们还希望导航栏保持半透明状态。

Our designer wants the navigation bar to have the same background color as the view's. However, they also want the navigation bar to remain translucent.

显然,如果我将其设置为非半透明状态,它可以获得一种享受:

Obviously if I set it to non-translucent it works a treat:

[[UINavigationBar外观] setTranslucent:NO];

但这不是理想的影响。有没有办法可以让它们变成相同的颜色,而不用花几个小时来调整导航栏的背景颜色?

But that is not the desired effect. Is there a way I can make them the same color without spending hours tweaking the background color of the navigation bar?

这就是我们设置导航时的样子查看相同颜色:

This is what it looks like when we set the navigation and view to the same color:

推荐答案

只需为背景和阴影设置空白图片:

Just set empty image for background and shadow:

[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [UIImage new];
self.navigationController.navigationBar.translucent = YES;

这篇关于导航栏与视图相同的bg颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆