开发者

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
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜