The first alert is not being shown?

I use this approach for modal messages like a windows MesageBox.Show(), all
goes OK unless I show another thing like a Loading. If an alert try to show
some text when a loading is being shown, something similar happens.

Karl

From:  MilkyJoe <[email protected]>
Date:  Fri, 24 Feb 2012 11:03:09 -0800 (PST)
To:  "[email protected]" <[email protected]>
Subject:  [MonoTouch] UIAlertView's alert message box not displaying

I have the following modal alert method:

public static int ShowModal (string title, string message, string
cancelButtonTitle = "Cancel", string[] otherButtons = null)
{
int clickedButtonIndex = -1;
using (UIAlertView alert = new UIAlertView(title, message, null,
cancelButtonTitle, otherButtons))
{
alert.Show ();
alert.Clicked += (sender, buttonArgs) =>
{
clickedButtonIndex = buttonArgs.ButtonIndex;
};
while (clickedButtonIndex == -1)
{
NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.25)); //
Wait 1/4 of a second
}

return clickedButtonIndex;
}
}

What I'm trying to do is, in the view's ViewDidAppear event, render an
alert, prompting the user to make a selection:

if (Alert.ShowModal ("A new article is available", "Do you want to retrieve
it now?", "No", new [] { "Yes" }) == 1)
{
// Do stuff
}

What's happening, though, is that the screen dims/darkens but the alert
message box doesn't appear at all. After a few seconds, my app crashes.

Can anyone see why this might be happening?

Thanks

--
View this message in context:
http://monotouch.2284126.n4.nabble.com/UIAlertView-s-alert-message-box-not-d
isplaying-tp4418334p4418334.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch



_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to