我通常使用以下代码进行确认警报
int buttonClicked = -1;
UIAlertView alert = new UIAlertView(title, message, null, NSBundle.MainBundle.LocalizedString ("Cancel", "Cancel"),
NSBundle.MainBundle.LocalizedString ("OK", "OK"));
alert.Show ();
alert.Clicked += (sender, buttonArgs) => { buttonClicked = buttonArgs.ButtonIndex; };
// Wait for a button press.
while (buttonClicked == -1)
{
NSRunLoop.Current.RunUntil(NSDate.FromTimeIntervalSinceNow (0.5));
}
if (buttonClicked == 1)
{
return true;
}
else
{
return false;
}
这似乎不适用于iOS7。循环继续运行,Clicked
事件似乎永远不会被触发。有没有人有一个如何进行确认警报的工作示例?