iOS 7:为整个应用程序禁用UINavigationBar Translucency [英] iOS 7 : Disable UINavigationBar Translucency For Entire App

查看:74
本文介绍了iOS 7:为整个应用程序禁用UINavigationBar Translucency的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法为整个应用程序禁用UINavigationBar Translucency?

Is there a way to disable UINavigationBar Translucency for an entire application?

我知道使用 [self.navigationController.navigationBar setTranslucent :NO] 可以解决单个控制器的这个问题,但我的应用程序中有很多UINavigationBars,这是一个非常繁琐的解决方案。

I'm aware that using [self.navigationController.navigationBar setTranslucent:NO] can fix this issue for a single controller, but I have a lot of UINavigationBars in my application and this is a pretty tedious solution.

我试过 [[UINavigationBar外观] setTranslucent:NO] ,但令人惊讶的是不支持该功能。这样做导致由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:'***非法属性类型,c表示外观设置器,_installAppearanceSwizzlesForSetter:'

I've tried [[UINavigationBar appearance] setTranslucent:NO], but that functionality is surprisingly not supported. Doing that results in Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Illegal property type, c for appearance setter, _installAppearanceSwizzlesForSetter:'

如果我必须,我可以通过我的整个应用程序设置UINavigationBars来逐个禁用半透明,但必须有一些更优雅的解决方案...

If I HAVE to, I can go through my entire app setting UINavigationBars to disable translucency one by one, but there must be some more elegant solution to this issue...

推荐答案

如果将堆栈中第一个导航栏的半透明度设置为 false [self.navigationController.navigationBar setTranslucent:NO] ,它将反映在推送到该堆栈的所有以下NavigationViewController中。

if you set the translucence of the first navigation bar in the stack to false [self.navigationController.navigationBar setTranslucent:NO], it will reflect in all the following NavigationViewController that are pushed to that stack.

这篇关于iOS 7:为整个应用程序禁用UINavigationBar Translucency的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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