I have a UIButton that should have 2 statuses – “Play” and “Pause”; i.e. – at the first time the user sees it it says “Play” and then whenever the user clicks it it should switch between “Play” and “Pause”.
I managed to create the controller itself – the content is played and paused properly – but I cannot seem to change the UIButton Text Label text.
I use:
myButton.titleLabel.text = @"Play";
myButton.titleLabel.text = @"Pause";
It’s not working. The text is not changing. I also tried [myButton.titleLabel setText:@”Pause”] and it’s not working as well.
How can I set it?
It should be:
You need to pass the
stateas well. You can check otherstate‘s here.You can then do something like this: