Quote:
Originally Posted by Mike J
Just curious....how would you do it if you had more than 1. When one was pressed none are moved and when the other is pressed it moves.
|
Hey. Here's a code snippet from one of my apps. I basically have 4 text fields and I keep them on their own view pane. When the didStartEditing is called it slides the whole view pane the propper distance so each text field gets put in the same place for editing. If you do not want to make a separate view pane for your text fields, you could just slide whichever view is their superview.
Code:
- (IBAction)didStartEditing:(UITextField *)textField { //move the text fields into view
[UIView beginAnimations: @"center text" context: nil];
[UIView setAnimationDelegate: self];
[UIView setAnimationDuration:0.35];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
float newY = textContainer.frame.origin.y - (textField.frame.origin.y - 75);
[textContainer setFrame:CGRectMake(textContainer.frame.origin.x, newY, 349, 231)];
[UIView commitAnimations];
}
textContainer is just a UIView holding 4 UITextField's.
-noodles