UIAlertView has some different styles that can be applied to it. The UIAlertViewStyleLoginAndPasswordInput creates a simple login popup.
UIAlertView alert = new UIAlertView (); alert.Title = "Login"; alert.AddButton ("Login"); alert.AddButton ("Cancel"); alert.Message = "Please enter your login details"; alert.AlertViewStyle = UIAlertViewStyle.LoginAndPasswordInput; alert.Clicked += ButtonClicked; alert.Show ();
And the clicked event handler
public void ButtonClicked(object sender, UIButtonEventArgs e) { UIAlertView parent_alert = (UIAlertView)sender; if (e.ButtonIndex == 0) { // OK button UIAlertView alert = new UIAlertView (); alert.Title = "Login"; alert.AddButton ("DONE"); alert.Message = "Login: " + parent_alert.GetTextField(0).Text + "\n" + "Password: " + parent_alert.GetTextField(1).Text; alert.Show (); } else{ // Cancel button UIAlertView alert = new UIAlertView (); alert.Title = "Login"; alert.AddButton ("DONE"); alert.Message = "Cancel Clicked"; alert.Show (); } }