Make UIAlertView pause your app until OK clicked

Huy
The Full Snack Developer
1 min readSep 10, 2016

Sometime, we need to show an UIAlertView and pause app until user tap on to the OK button.

For example, you need to check if there are enough memory to run your game on the device or not. If yes, just run the game, if not enough, you must pause the game and display the error message, don’t allow the program to continue execute (which will make the game crash, due to low memory).

The idea for this solution is after you display the alert message, while it’s not closed, run a loop to delay code execution at that point. (originally here)

Enough talking, this is how to do it:

--

--

Huy
The Full Snack Developer

I write code, draw stuff. Currently interested in Machine Learning and Note Taking Techniques.