我正在 iOS 7 上编写一个应用程序,但我似乎无法处理导航栏和工具栏的透明度,如何将导航栏设置为不透明度为 50% 的黑色?
我已经阅读了向 ios7 的过渡指南,并且观看了 wwdc13 讲座 214,但我的状态栏仍然具有与附加导航栏的其余部分不同的透明度。
这是我的代码:
// APP-WIDE THEMING
[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackOpaque];
[[UINavigationBar appearance] setBackgroundColor:[UIColor blueColor]];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
这是我的问题的屏幕截图:http://grab.by/qiyU
最佳答案
将背景图像设置为nil,并将背景颜色设置为alpha。
[ctrl.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
ctrl.navigationController.navigationBar.backgroundColor = [UIColor colorWithRed:0 Green:0 Blue:0 Alpha:.5];
关于objective-c - 如何使我的导航栏统一半透明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18821347/