繁体   English   中英

在MoreNavigationController中更改文本颜色

[英]Change text color in MoreNavigationController

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

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

我得到一个黑色的背景。 有关如何更改文字颜色的任何想法?

试试这个:

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版本:

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