Reputation: 2395
I have an Xcode project programmed in Swift. I have an alert variable:
I also have the actual code for when the alert appears:
When I click on the 'Yes' button, everything resets and I can play the game again.
If I want to play again and win, the alert now has stacked buttons.
How do I get rid of that and make it appear like the first time?
Upvotes: 2
Views: 3468
Reputation: 12615
Don't keep adding new actions to your alert box.
Either create a new alert box, or use a flag to indicate you've already created the options, so you don't add them again.
It's turning into the vertical list ("Action Sheet") format, because it now thinks there are four entries and there's not enough room to add them horizontally. But two of them have blank labels, because it's not letting you duplicate the text, to avoid ambiguity for the end user.
Upvotes: 3