2016-03-09 3 views
2

У меня есть этот код, чтобы настроить мой moreNavigationController:Изменить TintColor из UIImageView в 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]; 
    } 
} 

И я изменил образа моего TabBar в серый и зеленый, но когда я нажимаю над тем больше кнопки это результат:

enter image description here

Я не понимаю, почему это синий, так что я попытался изменить оттенок цвета, но ничего не швы на работу.

Я добавил этот код в моей функции:

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

И это то, что я могу видеть в переменных:

enter image description here

enter image description here

Любая помощь будет оценена ,

+1

Попробуйте это --- image = [image imageWithRenderingMode: UIImageRenderingModeAlwaysTemplate]; –

+0

поставить этот код в 'viewDidLayoutSubviews' – techloverr

+0

Спасибо всем, я старался как подход в одиночку и вместе, и изображение синий вместо красного –

ответ

2

Перепробовав много это окончательный код:

UITableView *tView = (UITableView*)tabController.moreNavigationController.topViewController.view; 
UIColor *tViewColor = MORE_TINTCOLOR; 
[tView setTintColor: tViewColor]; 
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]; 
    } 
} 

вы должны изменить UITableView TintColor.

Спасибо всем.

Смежные вопросы