Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UINavigationBar和UITabBar色调与UIView匹配_Ios_Objective C_User Interface_Uinavigationbar_Uitabbar - Fatal编程技术网

Ios UINavigationBar和UITabBar色调与UIView匹配

Ios UINavigationBar和UITabBar色调与UIView匹配,ios,objective-c,user-interface,uinavigationbar,uitabbar,Ios,Objective C,User Interface,Uinavigationbar,Uitabbar,我正在设置UINavigationBar和UITabBar的bartincolor。我希望我的ui视图的背景颜色完全相同,以便导航栏和选项卡栏看起来不可见。然而,我无法得到匹配的颜色 这里的背景设置为与导航栏完全相同的颜色。 下面是我如何调整条的颜色: [[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.78 green:0.05 blue:0.2 alpha:1]]; [[UINavigationBar

我正在设置
UINavigationBar
UITabBar
bartincolor
。我希望我的
ui视图
的背景颜色完全相同,以便导航栏和选项卡栏看起来不可见。然而,我无法得到匹配的颜色

这里的背景设置为与导航栏完全相同的颜色。

下面是我如何调整条的颜色:

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.78 green:0.05 blue:0.2 alpha:1]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTranslucent:NO];

我几乎完全复制了你的步骤,并且能够匹配颜色

主要区别在于我将BartinColor:直接设置为它的根视图的背景色

这是我的密码:

 itemsViewController.view.backgroundColor = [UIColor redColor];

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:itemsViewController];


navController.navigationBar.barTintColor = itemsViewController.view.backgroundColor;
navController.navigationBar.tintColor = [UIColor whiteColor];
navController.navigationBar.translucent = NO;

所以我要说的是,您的问题是您没有设置正确的BartinColor:,因为您的RGB颜色值不正确。我会将您的工作重点放在那里。

您只需设置:

navigationBar.tintColor = [UIColor redColor];
navigationBar.translucent = NO;
因此,每当您为
ui视图
提供与导航栏相同的颜色时,它都会匹配

半透明
设置为
才是真正的解决方案