Reputation: 2890
I have a tableViewCell with image view.
Even though I clear the imageView and set the image I get the below unintended behaviour, where one image is overlaid over the other.
Please advice how this could be resolved.
Code on Resetting Image in ImageView:
self.profileImageLabelTVCell.cellImageView.image = nil // Clearing previous image
self.profileImageLabelTVCell.cellImageView.image = image
Here is the link for the tableViewCell code and roundedImageView class, that I've used. (Since SO did not allow the entire code to be posted here)
https://gist.github.com/pravishanth/14cdb8bf14dd8899b081bdc97988b985
Upvotes: 2
Views: 68
Reputation: 6200
Add your reset image code to the TableViewCell
's
func prepareForReuse()
method.
override func prepareForReuse() {
super.prepareForReuse()
cellImageView.image = nil
}
Upvotes: 1