3

So in my iOS app I have a menu designed like this:

enter image description here

The Images are created with the following code:

cell.imageCell?.image = menuItems[indexPath.row].image cell.imageCell.image = cell.imageCell.image?.withRenderingMode(.alwaysTemplate) cell.imageCell.tintColor = MenuTableViewController.fontColor cell.imageCell.backgroundColor = UIColor.clear 

This code is placed in the tableview cellForRowAt function. Now all the different viewcontrollers(HomeViewController, InfoViewController etc...) have no access at all to the menu controller and thus are not able to change the color of the image and nowhere else am I changing the color of these images. Now when I press one of the tabs that don't use any Alerts or modal views like home or info, the images stay perfectly fine, however when I press on Weather or excursions which download a json file with URLSession dataTask and display an alert telling to please wait, the images turn grey like the following:

enter image description here

I'm not sure how this is even possible that one viewcontroller can change another viewcontrollers subviews. Thanks in advance -Jorge

3
  • 2
    Perhaps what you see is a dimmed presentation of your icons. Don't use image templates or set tintAdjustmentMode to normal to stop fading icons. Usually that happens if you display alert or modal controller. Commented Feb 16, 2017 at 16:28
  • You are right it wasn't the URLSessions problem, it was the alert telling to please wait that changed the color, and setting the tintAdjustmentMode to normal did the trick. If you want to post an answer i'll accept it as the right one. Commented Feb 16, 2017 at 18:13
  • glad I guessed it right. I have posted an answer below. Thanks Commented Feb 16, 2017 at 22:14

2 Answers 2

17

Perhaps what you see is a dimmed presentation of your icons. Don't use image templates or set tintAdjustmentMode to normal to stop fading icons. Usually that happens if you display alert or modal controller.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for this. It fixed my issue.
1

It looks like its the default UITableViewCell click style. Try to set the style to none, as answered here: How can I disable the UITableView selection highlighting?

Swift:

cell.selectionStyle = UITableViewCellSelectionStyle.none 

2 Comments

If you feel that this question is a duplicate, flag it as such. It's generally a bad practice to duplicate answers.
@JAL its not a duplicate, he described a certain problem, and i suggested a solution. the link above just shows how to do it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.