【发布时间】:2013-10-10 22:06:41
【问题描述】:
有没有什么方法可以让UINavigationBar(针对 iOS 7)变成没有半透明的纯色?我已经尝试设置背景颜色、barTintColor、不透明、透明/半透明等......但没有任何效果。
有人知道怎么做吗?
这是我一直在使用的一些代码块。注意我在navigationBar 上设置的属性。它们中的任何一个,以任何顺序或组合都没有奏效。
@property (strong, nonatomic) UITabBarController *tabBarController;
testViewController = [[TestViewController alloc] init];
anotherViewController = [[AnotherViewController alloc] init];
navigationController = [[UINavigationController alloc]
initWithRootViewController:testViewController];
navigationController.navigationBar.barTintColor = [UIColor darkGrayColor;
navigationController.navigationBar.barStyle = UIBarStyleBlack;
navigationController.navigationBar.translucent = YES;
navigationController.navigationBar.opaque = YES;
NSArray *tabBarViewControllers = [NSArray arrayWithObjects:
navigationController,
anotherViewController, nil];
self.tabBarController.viewControllers = tabBarViewControllers;
【问题讨论】:
-
贴出你设置半透明的代码。
-
请检查编辑。谢谢。
-
尝试将
self.navigationController.navigationBar.translucent = NO;放入您的testViewController。
标签: objective-c ios7 uinavigationbar transparency