Julian Pomper Julian Pomper - 1 year ago 108
Swift Question

Old UILabel text stays in background

I want to change the text of an

, 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
text nil or "" but its the same result.

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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download