Merge UIAlertViewStyleLoginAndPasswordInput with UIKeyboardTypeEmailAddress

Is there a way to display UIAlertView input / password text fields so that the keyboard type is of type UIKeyboardTypeEmailAddress ?

I am using UIAlertView as follows:

 var alertView = new UIAlertView("Login".Translate(), "", null, "Cancel".Translate(), "Login".Translate()); alertView.AlertViewStyle = UIAlertViewStyle.LoginAndPasswordInput; 

or, in Objective-C:

 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Login", nil]; [alertView setAlertViewStyle:UIAlertViewStyleLoginAndPasswordInput]; 

but all the usernames of my application are email addresses, so I would like to have a text field keyboard to enter as an email address keyboard, i.e. UIKeyboardTypeEmailAddress .

Any ideas?

+4
source share
1 answer

Got it. You can get the UIAlertView text box and set the style there:

 alertView.GetTextField(0).KeyboardType = UIKeyboardType.EmailAddress; 

Obj-C:

 [[alertView textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeEmailAddress]; 
+8
source

All Articles