Here's how you can make your dialogue modal.
I came across this while researching a similar question from a MonoTouch / C # user, so I wrote this sample for him. The same pattern can be trivially ported to Objective-C.
To do this, you can simply start mainloop manually. I was not able to stop mainloop directly, so instead I started mainloop for 0.5 seconds and wait for the user to respond.
The following function shows how you could implement a modal query using the above approach:
int WaitForClick () { int clicked = -1; var x = new UIAlertView ("Title", "Message", null, "Cancel", "OK", "Perhaps"); x.Show (); bool done = false; x.Clicked += (sender, buttonArgs) => { Console.WriteLine ("User clicked on {0}", buttonArgs.ButtonIndex); clicked = buttonArgs.ButtonIndex; }; while (clicked == -1){ NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.5)); Console.WriteLine ("Waiting for another 0.5 seconds"); } Console.WriteLine ("The user clicked {0}", clicked); return clicked; }
source share