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
A quite nice approach is, you can use the delegate methods of the UITextFieldDelegate to move the dialog up only when the keyboard is activated. See below.
- (void)textFieldDidBeginEditing:(UITextField *)textField {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, -20);
[dialog setTransform: moveUp];
[UIView commitAnimations];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
CGAffineTransform moveDown = CGAffineTransformMakeTranslation(0.0, 0.0);
[dialog setTransform: moveDown];
[textField resignFirstResponder];
return YES;
}