How can I check if the hide button pf iPad's k

2019-07-16 16:32发布

问题:

I want to trigger a function that will depend on which method the user used to resign a textField's first responder. If it was resigned by selecting another textField, it does nothing, else triggers a function. Is this possible?

回答1:

Found out how. You just have to listen to the UIKeyboardWillHideNotification notification:

- (void)viewDidLoad {

    [super viewDidLoad];

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

- (void)methodYouWantToCall {

    //Do anything you want here

}