How can I check if the hide button pf iPad's keyboard was pressed?

∥☆過路亽.° 提交于 2020-01-04 05:28:54

问题


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

}



来源:https://stackoverflow.com/questions/8320508/how-can-i-check-if-the-hide-button-pf-ipads-keyboard-was-pressed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!