Change TintColor of the UIImageView in moreNavigationController

Viewed 168

I have this code to customize my moreNavigationController:

UITableView *tView = (UITableView*)tabController.moreNavigationController.topViewController.view;
if ([[tView subviews] count]) {
    for (UITableViewCell *cCell in [tView visibleCells]) {
        cCell.textLabel.textColor = TABLECELL_TEXT_COLOR;
        cCell.textLabel.highlightedTextColor = TABLECELL_TEXT_COLOR_HIGHLIGHTED;
        cCell.contentView.backgroundColor = TABLECELL_BACKGROUND_COLOR;
        cCell.backgroundColor = TABLECELL_BACKGROUND_COLOR;
        UIView * selectedBackgroundView = [[UIView alloc] init];
        UIColor *uicCell = TABLECELL_BACKGROUND_COLOR_SELECTED
        [selectedBackgroundView setBackgroundColor:uicCell];
        [cCell setSelectedBackgroundView:selectedBackgroundView];
    }
}

And I have changed the images of my TabBar to Gray and Green but when I click over the more button this is the result:

enter image description here

I don't understand why is blue, so I have tried to change the tint color but nothing seams to work.

I have added this code to my function:

UIImageView *imgV = cCell.imageView;
imgV.tintColor = [UIColor redColor];
[imgV setTintColor:[UIColor redColor]];
UIImageView *imgV2 = imgV;

And this is what I can see in the variables:

enter image description here

enter image description here

Any help will be appreciated.

2 Answers

This is a the solution for Swift 5:

Add the following in viewDidLoad of the subclass of UITabBarController

if let topViewController = self.moreNavigationController.topViewController {
    if let tableView = topViewController.view as? UITableView {
        tableView.tintColor = .accent
    }
}

enter image description here

Related