Created
September 17, 2016 05:41
-
-
Save RameshAran/b2eaf360b7e88437810d7db34ef6ec9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)showAlertWithTextField { | |
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Menu" | |
message:@"Select a menu" | |
preferredStyle:UIAlertControllerStyleAlert]; | |
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) { | |
//Customize the 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 addAction:[UIAlertAction actionWithTitle:@"ok" | |
style:UIAlertActionStyleDefault | |
handler:^(UIAlertAction *action) { | |
NSLog(@"action - %@", action.title);//callback | |
}]]; | |
[self presentViewController:alertView animated:YES completion:^{ | |
NSLog(@"completed"); | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
create an Alert with a TextField.