【发布时间】:2014-11-07 06:35:49
【问题描述】:
在 iOS 7 中,导航栏对下方滚动的内容具有模糊效果。我希望我的导航栏是透明的,可以这样实现:
[[UINavigationBar appearance] setBarStyle:UIBarStyleDefault];
[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[UIImage new]];
[[UINavigationBar appearance] setBackgroundColor:[UIColor clearColor]];
但我也希望内容模糊。我尝试了以下方法,但没有成功:
[[UINavigationBar appearance] setBarTintColor:[UIColor clearColor]];
[[UINavigationBar appearance] setBarStyle:UIBarStyleDefault];
[[UINavigationBar appearance] setShadowImage:[UIImage new]];
[[UINavigationBar appearance] setBackgroundColor:[UIColor clearColor]];
相反,这会使导航栏模糊内容视图但为黑色。如果我删除setBarTintColor,导航栏会模糊内容,但它是白色的。我尝试了各种其他组合,但导航栏不是白色就是黑色。
我查看了几个 SO 问题,但它们对我没有帮助。他们回答了如何获得completely transparent navbar 或get a certain colour,而我只想让它清晰/透明,没有任何颜色。
我将如何实现这一目标?感谢您的帮助,不胜感激!
【问题讨论】:
标签: ios objective-c iphone cocoa-touch ios7