Ios 在“更多”菜单中更改UITabBar色调颜色

Ios 在“更多”菜单中更改UITabBar色调颜色,ios,uitabbar,tintcolor,Ios,Uitabbar,Tintcolor,我正在尝试更改更多菜单中图标的蓝色。我尝试了几乎所有我在堆栈溢出上找到的东西,但没有任何效果。 我试过这个,但不起作用 我发现改变颜色的唯一选择是 [[UIView appearance] setTintColor:[UIColor redColor]]; 但它会改变应用程序中的所有颜色 代码只是一个带有故事板的新项目,所以我只是在故事板上添加了视图。 谢谢你的帮助 编辑:添加代码后: UIImage *myImage = [[UIImage imageNamed:@"music.

我正在尝试更改更多菜单中图标的蓝色。我尝试了几乎所有我在堆栈溢出上找到的东西,但没有任何效果。 我试过这个,但不起作用

我发现改变颜色的唯一选择是

[[UIView appearance] setTintColor:[UIColor redColor]];
但它会改变应用程序中的所有颜色

代码只是一个带有故事板的新项目,所以我只是在故事板上添加了视图。
谢谢你的帮助

编辑:添加代码后:

    UIImage *myImage = [[UIImage imageNamed:@"music.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"New Title" image:myImage selectedImage:[UIImage imageNamed:@"music.png"]];

选择视图时,图像会发生更改,但仍为蓝色。

要执行所需操作,应通过为每个控制器创建UIAbbarItem来使用图像,并添加图像和选定图像

从@Aaron Brager这里可以看到:

关闭完整代码后进行编辑 首先,您的项目中有许多错误,资产应该在xcassets文件夹中,在view didload中,在“super viewDidLoad]”之后编写代码,等等

关于您的问题,在FirstViewController中的viewDidLoad方法中

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    // Your code start here, not before the super
    [[UITabBar appearance] setTintColor:[UIColor redColor]];

    // Get table view of more new viewController
    UITableView *view =(UITableView*)self.tabBarController.moreNavigationController.topViewController.view;

    view.tintColor = [UIColor redColor]; // Change the image color

    if ([[view subviews] count]) {
        for (UITableViewCell *cell in [view visibleCells]) {
            cell.textLabel.textColor = [UIColor redColor]; // Change the text color

        }
    }
}

这是Swift版本的

请记住,这个版本只会更改色调,因为原始答案中文本颜色的更改非常粗糙。要正确更改它,您必须覆盖
moreNavigationController
及其
cellForRowAt
功能

tabBarController?.tabBar.tintColor = .red

if let moreTableView = tabBarController?.moreNavigationController.topViewController?.view as? UITableView {
    moreTableView.tintColor = .red
}

更改此按钮的颜色

    moreNavigationController.navigationBar.tintColor = .white

感谢您的回复,我尝试了来自建议的代码,但仍然不起作用。我想我做错了什么。如果你能看一下,我附上了完整的代码。@varu我刚刚更新了我的答案。我不明白你在用故事板!我在2010年开始的一个更大的项目中遇到了着色问题,我不得不用图标解决这个问题。我为StackOverflow创建了一个新项目。非常感谢你帮助我。我真的很感谢你的帮助。我还有很多东西要学:)有没有办法隐藏上面的编辑按钮?