我正在尝试为导航栏设置纯色,但它总是显得半透明.
我试过的SO答案似乎都没有效果.
我试过了:
在App代表中:
[[UINavigationBar appearance] setBackgroundColor:[UIColor colorWithRed:89/255.0 green:196/255.0 blue:197/255.0 alpha:1.0f]];
Run Code Online (Sandbox Code Playgroud)
在我的主TableviewController中:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:89/255.0 green:196/255.0 blue:197/255.0 alpha:1.0f];
self.navigationController.navigationBar.translucent = NO;
}
Run Code Online (Sandbox Code Playgroud)
我也取消选中该Translucent选项并检查Opaque属性检查器中的选项.
以下是我想要实现的目标的图像:
如何使用纯色背景使导航栏不透明?
谢谢.
我正在使用以下代码行更改UIPickerView整个应用程序的背景颜色,就像应用程序中的主题一样。这没有任何改变。
[[UIPickerView appearance] setBackgroundColor: [UIColor orangeColor]];
Run Code Online (Sandbox Code Playgroud)
我也尝试了以下行,但这给出了一个看起来很糟糕的奇怪阴影背景。
[[UIView appearanceWhenContainedInInstancesOfClasses:@[[UIPickerView class]]] setBackgroundColor: [UIColor darkGrayColor]];
Run Code Online (Sandbox Code Playgroud)
我希望背景颜色是一种纯色。
问题是,如何使用 更改UIPickerView整个应用程序的背景颜色UIAppearance?