简体   繁体   English

在MoreNavigationController中更改文本颜色

[英]Change text color in MoreNavigationController

I hope I'm not duplicating any threads now but I can't find a good answer to my question. 我希望我现在不会重复任何线程,但我找不到我的问题的好答案。 I have more than five tabs so a more-tab automatically turns up. 我有五个以上的标签,因此更多标签会自动显示。 I've managed to change some of it's setting, such as title, background and style of the navigationbar and so on. 我设法改变了它的一些设置,例如标题,背景和导航栏的样式等等。 My problem is that I can't figure out how to change the text color in the more table view. 我的问题是我无法弄清楚如何在更多的表视图中更改文本颜色。 The rest of the app has black background in all table views, with white text. 应用程序的其余部分在所有表视图中都带有黑色背景,带有白色文本。

With the code-line: tabBarController.moreNavigationController.topViewController.view.backgroundColor = [UIColor blackColor]; 使用代码行: tabBarController.moreNavigationController.topViewController.view.backgroundColor = [UIColor blackColor];

I get a black background. 我得到一个黑色的背景。 Any ideas on how to change the text color? 有关如何更改文字颜色的任何想法?

Try this: 试试这个:

UITableView *view = (UITableView*)self.tabBarController.moreNavigationController.topViewController.view;
    if ([[view subviews] count]) {
        for (UITableViewCell *cell in [view visibleCells]) {
            cell.textLabel.textColor = [UIColor redColor];
        }
    } 

Swift 4 version: Swift 4版本:

if let tableView = moreNavigationController.topViewController?.view as? UITableView {
    for cell in tableView.visibleCells {
        cell.textLabel?.textColor = .red
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM