Connor
Connor

Reputation: 64644

UITableViewCell content shifting after selection

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?

Upvotes: 2

Views: 502

Answers (2)

Savas Adar
Savas Adar

Reputation: 4262

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

Upvotes: 2

Connor
Connor

Reputation: 64644

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.

Upvotes: 0

Related Questions