I need to dismiss keyboard which show itself when I click UITextField
from childView. I need to do this in method (scrollViewWillBeginEditing
) which is in parentViewController. How can I do it?
EDIT:
I have method in childViewController:
- (void)dismissKeyboard {
[self.textField resignFirstResponder];
NSLog(@"%@", self.textField.text);
}
and .h of childViewController:
@protocol VVInformationTableViewControllerDelegate<NSObject, UIScrollViewDelegate>
-(void)dismissKeyboard;
@end
@interface VVInformationTableViewController : UITableViewController <UITextFieldDelegate, UITableViewDelegate, UIScrollViewDelegate, VVInformationTableViewControllerDelegate>
@property (weak, nonatomic) id<VVInformationTableViewControllerDelegate> delegate;
and I try to call it in:
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
[self.infoTableController dismissKeyboard];
}
When it is call then NSLog print (null) and keyboard didn't dismiss, but when I call dismissKeyboard from childViewController then it print true value and keyboard dismiss.
Any help?
You can use the following code