UIALertView - retreive textfield value from textfield added via code

Posted by George on Stack Overflow See other posts from Stack Overflow or by George
Published on 2010-03-13T21:13:32Z Indexed on 2010/03/13 21:15 UTC
Read the original article Hit count: 434

Filed under:
|

Here is the code I have to create an UIalertView with a textbox.

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter A Username Here"     message:@"this gets covered!" 
                                               delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK!", nil];   
    UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)];

    CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60);
    [alert setTransform:myTransform];
    alert.tag = kAlertSaveScore;

    [myTextField setBackgroundColor:[UIColor whiteColor]];
    [alert addSubview:myTextField];
    [alert show];
    [alert release];
    [myTextField release];  

My question is, how do I get the value from the textfield in:

- (void) alertView:(UIAlertView *) actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

}

I know I can get the standard stuff for the alertview such as actionSheet.tag and such, but how would I get the above created textfield?

Thanks in advance for any and all help.

Geo...

© Stack Overflow or respective owner

Related posts about iphone

Related posts about xcode