2

I have a tableview where each cell has an image to the left of a label and detail label like so:

enter image description here

It renders just like that as it is supposed to when the tableview first loads, but if I click the cell to navigate to a different view then return to the table view the image shifts to cover part of the label like this:

enter image description here

The change happens about a second after the tableview appears and it only happens to the cell that was previously selected. Does anyone have any idea what is causing this?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Connor Pearson
  • 63,902
  • 28
  • 145
  • 142

2 Answers2

2

I faced same issue. I was set my custom UIImageView's name as imageView and Now I changed it's name as mImageView and fixed.

Maybe you should rename your imageView @IBOutlet name.

Incorrect using - Not working properly

@IBOutlet var imageView: UIImageView!

Correct Using

@IBOutlet var mImageView: UIImageView!

Very strange issue

Savas Adar
  • 4,083
  • 3
  • 46
  • 54
0

This may not be the best answer, but it's what worked for me. Eventually I just deleted all of the subviews in the cell and readding them. It now works fine without having to mess with constraints. I'm not sure what the cause of the problem was.

Connor Pearson
  • 63,902
  • 28
  • 145
  • 142
  • 1
    I wonder if it could have been related to this: https://stackoverflow.com/questions/11681273/uitableviewcell-imageview-changing-on-select/17123367#17123367 – Adam Jack Jul 21 '16 at 21:53
  • @AdamJack it was for me , for some reason my image view had two bindings instead of 1 , i just deleted the binding and created a new one with another name and it worked! thanks for the link – A.Alqadomi Sep 24 '18 at 07:03