Andrej
Andrej

Reputation: 7426

UIButton gets shown before title gets updated?

I'm trying to change the title of a hidden button and soon after I'd like to un-hide it (to show it). Here's the code:

recordButton.setTitle("Stop", forState: .Normal)
recordButton.hidden = false

The problem is that the button gets shown with his old title and only after that the new title appears. Maybe it takes 0.1 second, but it's noticeable and disturbing. Additionally I've checked and can confirm that the title's text is "Plain" (not "Attributed").

Am I missing something?
How to properly change the buttons title and then show it only when the title is already updated?
Should I make some verifications before calling recordButton.hidden = false?

Upvotes: 0

Views: 39

Answers (1)

slxl
slxl

Reputation: 689

Ensure that you are using UIButton with type UIButtonType.Custom

In a storyboard it can be set here: enter image description here

Upvotes: 2

Related Questions