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
}