简体   繁体   中英

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];

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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