Creating modal dialogs and using text input
Often, there are moments in the game when you need to display a dialog and require the user to choose an option before continuing. For example, you might want to prompt for the player's name when they achieve a highscore.
Of course, you can just use the pushScene:
method and display the whole new scene. However, sometimes, these dialogs are so small and you want them to cover only a small portion of the underlying scene.
Also, sometimes, you don't want to suspend the running scene while showing the dialog. There are tons of other cases when you might want to show a modal dialog without a separate scene.
In this chapter, we are going to create several custom dialogs and use the built-in UIAlertView
class. We are going to create a pause dialog, a dialog to enter the highscore, and a dialog that is displayed after you win or lose the game.