I placed a UITextField into a UIAlertView and moved it up so the keyboard wouldn\'t cover it up with the following code:
[dialog setDelegate:self];
[dialog s
This is for iOS5 and ARC.
-(void)showAlert {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"New Album"
message:@"Enter a name for the album."
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Save", nil];
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField* textfield = [alertView textFieldAtIndex:0];
textfield.placeholder = @"Title";
[alertView show];
}
-(void)alertView:(UIAlertView *)alertView
didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex != 1) {
NSLog(@"Cancel");
return;
}
UITextField* textfield = [alertView textFieldAtIndex:0];
NSLog(@"Save. text: %@", textfield.text);
}