-3

enter image description hereI have method for textfield animation which is running on after resignfirsrresponder i want that method also be called when user presses down arrow of the ipad which hides keyboard any idea how to do this. thanks.

I have added screenshots the button beside ABC text button i when we press that button normally keyboards hides i want to call animation on that button click.

Developer IOS
  • 115
  • 1
  • 2
  • 11

4 Answers4

2

For Ipad down arrow key You can use notification

  [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(keyboardWillHide)
                                                     name:UIKeyboardWillHideNotification
                                                   object:nil];

-(void)keyboardWillHide
{
//call when key board hides
}
08442
  • 521
  • 2
  • 13
0

You can call the textfield animation method in any one of the following UITextFieldDelegate methods

- (void)textFieldDidEndEditing:(UITextField *)textField {


}

or

- (BOOL)textFieldShouldReturn:(UITextField *)textField {

    return YES;
}
Venk
  • 5,949
  • 9
  • 41
  • 52
0

just write your code inside

- (void)textFieldDidEndEditing:(UITextField *)textField {


}

And don't forget to bind textfield delegate and write <UITextfieldDelegate> in .h file

Shah Paneri
  • 729
  • 7
  • 28
0

if you want use done button on key board take one view with done button and write this method

-(void)textFieldDidBeginEditing:(UITextField *)textField
{   
    [textField setInputAccessoryView:self.doneView];
}

and then give following action to that done button

-(IBAction)doneButtonPressed:(id)sender
{
    [currentTextField resignFirstResponder];
}
ganesh manoj
  • 977
  • 10
  • 24