Julian Pomper Julian Pomper - 2 months ago 16
Swift Question

Old UILabel text stays in background

I want to change the text of an

UILabel
, but when I set the new text, the old one stays in the background and they are over each other.

Here is what it looks like:
enter image description here

I tried to set the
UILabel
text nil or "" but its the same result.

self.nameLabel.text = ""
self.nameLabel.text = self.user.getFullName()

Answer

I added the UILabel in the viewDidLayoutSubviews() so there were multiple labels in it because viewDidLayoutSubviews() was called multiple times.

Comments