Friday, 6 July 2012

Adding different input fields to UIAlertView

The following scenarios will explain how different input fields can be added to an UIAlertView

Code for creating an UIAlertView:

UIAlertView *passwordAlert = [[UIAlertView alloc]
                               initWithTitle:@"Enter Password" 
                               message:@"" 
                               delegate:self 
                               cancelButtonTitle:nil
                               otherButtonTitles:@"Submit",nil]; 


Adding text field to UIAlertView:

passwordAlert.alertViewStyle = UIAlertViewStylePlainTextInput;

Adding password field to UIAlertView:

passwordAlert.alertViewStyle = UIAlertViewStyleSecureTextInput;

Adding login and password field to UIAlertView:

passwordAlert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;