UIAlertView *alertViewChangeName=[[UIAlertView alloc]initWithTitle:@"Change Name" message:@"What is your teacher's name?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
alertViewChangeName.alertViewStyle=UIAlertViewStylePlainTextInput;
[alertViewChangeName show];
I am just looking to retrieve the input from the textbox and place it within a UILabel or an NSString to later use and/or manipulate.
You will need to invoke UIAlertView's
delegate method
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
NSString *test = [[alertView textFieldAtIndex:0] text];
}
You just need to use the -textFieldAtIndex:
method on UIAlertView to get your Textfield. e.g:
UIAlertView *alert = ...
UITextField *textInput = [alert textFieldAtIndex:0];
textInput.text = ...
// get user input
NSString *userInput = textInput.text;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With