Objective c 如何更改选项卡栏控制器的颜色

Objective c 如何更改选项卡栏控制器的颜色,objective-c,Objective C,是否有任何方法可以将选项卡栏控制器的颜色更改为默认黑色以外的颜色?我知道这在IB中是不可能的,但可能是通过AppDelegate中的代码实现的 self.tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor grayColor]; 在AppDelegate中 self.tabBarController.moreNavigationController.navigationBar.tintColo

是否有任何方法可以将选项卡栏控制器的颜色更改为默认黑色以外的颜色?我知道这在IB中是不可能的,但可能是通过AppDelegate中的代码实现的

self.tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor grayColor];
在AppDelegate中

self.tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor grayColor];

在AppDelegate.m中的didFinishLaunching。。。方法写入(这将更改整个应用程序):

或者,您可以在viewDidLoad方法中的ViewController.m中写入:

[self.tabBarController.tabBar setBarTintColor: [UIColor mycolor]];

在AppDelegate.m中的didFinishLaunching。。。方法写入(这将更改整个应用程序):

或者,您可以在viewDidLoad方法中的ViewController.m中写入:

[self.tabBarController.tabBar setBarTintColor: [UIColor mycolor]];

您可以使用XIB/Storyboard,也可以通过编程实现 对于Xib/storyboard,选择tab bar controller而不是tab,您可以看到更改tab bar或tab bar视图属性的所有选项,请参见附加图像

对于编程方式: 用于选项卡栏的色调和背景

[[UITabBar appearance] setTintColor:panelColor];
[[UITabBar appearance] setBarTintColor:[UIColor lightGrayColor]]; 

您可以使用XIB/Storyboard,也可以通过编程实现 对于Xib/storyboard,选择tab bar controller而不是tab,您可以看到更改tab bar或tab bar视图属性的所有选项,请参见附加图像

对于编程方式: 用于选项卡栏的色调和背景

[[UITabBar appearance] setTintColor:panelColor];
[[UITabBar appearance] setBarTintColor:[UIColor lightGrayColor]];