【问题标题】:Change text color in MoreNavigationController在 MoreNavigationController 中更改文本颜色
【发布时间】:2011-06-23 10:56:03
【问题描述】:

我希望我现在没有重复任何线程,但我找不到我的问题的好答案。 我有五个以上的标签,所以会自动出现更多标签。我已经设法更改了它的一些设置,例如导航栏的标题、背景和样式等。我的问题是我无法弄清楚如何在更多表格视图中更改文本颜色。应用程序的其余部分在所有表格视图中都有黑色背景,带有白色文本。

使用代码行:tabBarController.moreNavigationController.topViewController.view.backgroundColor = [UIColor blackColor];

我得到黑色背景。关于如何更改文本颜色的任何想法?

【问题讨论】:

    标签: iphone uitableview uitabbarcontroller textcolor


    【解决方案1】:

    试试这个:

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

    【讨论】:

    • 我删除了外部 if ([[view subviews] count]) 并且效果很好,谢谢。
    【解决方案2】:

    Swift 4 版本:

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

    【讨论】:

      猜你喜欢
      • 2019-04-02
      • 2012-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-19
      • 2016-08-07
      • 2015-07-29
      • 1970-01-01
      相关资源
      最近更新 更多