In Winforms development the MessageBox is a simple way of alerting the user of an action.
System.Windows.Forms.MessageBox.Show("This should be an error message","Error",MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
Which produces:
To achieve similar functionality in iOS we utalise the UIAlertView.
UIAlertView alert = new UIAlertView (); alert.Title = "Error"; alert.AddButton ("OK"); alert.AddButton ("Cancel"); alert.Message = "This should be an error message"; //alert.AlertViewStyle = UIAlertViewStyle.SecureTextInput; alert.Show ();
Which produces:
Also note the AlertViewStyle allows the view to take text input or act as a login screen.
And how you react to the taped one of the buttons?
Hi Vojtech Machacek J,
Below is the code for your answar,
alert.Clicked += (object s, UIButtonEventArgs ev) =>
{
int Button = ev.ButtonIndex;
};