I'm calling a UIAlertView
with the PlainTextView
style, and I'm trying to work out how I can get access to whatever the user entered in the text view before they clicked OK.
I'm using willDismissWithButtonIndex
and the alertView
doesn't seem to have any properties like text, or anything.
How can I get at it? Thanks in advance!
Get the text field with
UITextField *textfield = [alertView textFieldAtIndex: 0];
In your delegate method. Refer to the documentation for further information.
Edit march 2015 due to many views the swift equivalent :
let textfield = alertView.textFieldAtIndex(0)
UITextField *textfield = [alertView textFieldAtIndex: 0];
Use this in uialertview delegate
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
UITextField *textfield = [alert_name textFieldAtIndex: 0];
}
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