设置 UINavigationBar TintColor 仅设置其后退按钮颜色

发布于 2025-01-04 04:00:51 字数 307 浏览 4 评论 0原文

所以我正在设置 UINavigationBar 色调颜色,这就是我得到的:

在此处输入图像描述

[navController.navigationBar setTintColor:[UIColor whiteColor]];

这怎么可能?如果有帮助的话,这里还有一些更多信息:

在此处输入图像描述

SO I am setting a UINavigationBar tintColor and here's what I get:

enter image description here

[navController.navigationBar setTintColor:[UIColor whiteColor]];

How is this even possible? Here's some more info if it helps:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

妄想挽回 2025-01-11 04:00:51

我有一个 UINavigationController,我对其进行了如下自定义:

首先,拿出一个 44 像素高的图像作为导航栏的背景。 (在这种情况下,如果您想使用 44 像素高的白色图像,那就可以了 --- 但如果您使用某种类型的垂直渐变,它看起来会好得多)

其次,在您的AppDelegatedidFinishLaunching 方法。 (该图像名为“background_44.png”。

// Set the background image for *all* UINavigationBars
    UIImage *gradientImage44 = [[UIImage imageNamed:@"background_44.png"]
                                resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

// Set the background image for *all* UINavigationBars
    [[UINavigationBar appearance] setBackgroundImage:gradientImage44 
                                           forBarMetrics:UIBarMetricsDefault];

I've got a UINavigationController that I customize as follows:

First, come up with a 44px-high image as the background for the nav bar. (In this case, if you wanted to use a 44px-high white image, that'd do the trick --- but it'll look much nicer if you use some type of vertical gradient)

Second, use the following code in your AppDelegate's didFinishLaunching method. (The image is called "background_44.png".

// Set the background image for *all* UINavigationBars
    UIImage *gradientImage44 = [[UIImage imageNamed:@"background_44.png"]
                                resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

// Set the background image for *all* UINavigationBars
    [[UINavigationBar appearance] setBackgroundImage:gradientImage44 
                                           forBarMetrics:UIBarMetricsDefault];
影子是时光的心 2025-01-11 04:00:51

我将该代码放入我的项目中,工作得很好。甚至改变了酒吧的风格和颜色。没问题。这行代码很好,其他地方有问题或者是一些疯狂的故障。

I dropped that code in my project, worked fine. Even changed bar styles and colors. No problem. This line of code is fine, there is an issue somewhere else or its some crazy glitch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文