Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 288
Emil Avatar asked Feb 08 '11 13:02

Emil


2 Answers

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];
        }
    } 
like image 77
Stas Zhukovskiy Avatar answered Sep 23 '22 00:09

Stas Zhukovskiy


Swift 4 version:

if let tableView = moreNavigationController.topViewController?.view as? UITableView {
    for cell in tableView.visibleCells {
        cell.textLabel?.textColor = .red
    }
}
like image 24
fethica Avatar answered Sep 23 '22 00:09

fethica