Skip to content

Instantly share code, notes, and snippets.

@RameshAran
Created September 17, 2016 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RameshAran/492b5b6bb3cae7c792edf3cdb7ce0212 to your computer and use it in GitHub Desktop.
Save RameshAran/492b5b6bb3cae7c792edf3cdb7ce0212 to your computer and use it in GitHub Desktop.
- (void)showAlertWithTwoTextField {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Menu"
message:@"Select a menu"
preferredStyle:UIAlertControllerStyleAlert];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"User name";
textField.textColor = [UIColor whiteColor];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.backgroundColor = [UIColor colorWithRed:171/255 green:182/255 blue:255/255 alpha:0.5];
}];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Passcode";
textField.textColor = [UIColor whiteColor];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.backgroundColor = [UIColor colorWithRed:171/255 green:182/255 blue:255/255 alpha:0.5];
}];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);
}]];
[self presentViewController:alertView animated:YES completion:^{
NSLog(@"completed");
}];
}
@RameshAran
Copy link
Author

Create an Alert with two textfields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment