Set the tag for each TextField during viewdidload. Then you can determine the pop-up and off of the keyboard based on the following UITextField content.
Some TextField * names
Name. tag = 2;
The following figure shows that when tag = 2, the interface can be mentioned above.
-(Void) textFieldDidBeginEditing :( UITextField *) textField
{// This method is called when you click inside textField to start editing. TextField will become first responder
If (textField. tag = 2 ){
NSTimeInterval animationDuration = 0.30f;
CGRect frame = self. view. frame;
Frame. origin. y-= 216;
Frame. size. size + = 216;
Self. view. frame = frame;
[UIViewbeginAnimations: @ "ResizeView" context: nil];
[UIView setAnimationDuration: animationDuration];
Self. view. frame = frame;
[UIViewcommitAnimations];
}
}
-(BOOL) textFieldShouldReturn :( UITextField *) textField
{// When the user presses ruturn and removes the focus from textField, the keyboard disappears.
// TextField
If (textField. tag = 2 ){
NSTimeInterval animationDuration = 0.30f;
CGRect frame = self. view. frame;
Frame. origins. y + = 216;
Frame. size. height = 216;
Self. view. frame = frame;
// Self. view
[UIViewbeginAnimations: @ "ResizeView" context: nil];
[UIView setAnimationDuration: animationDuration];
Self. view. frame = frame; www.2cto.com
[UIViewcommitAnimations];
}
[TextField resignFirstResponder];
ReturnYES;
}