在iOS上全局检测背景中的键盘显示/隐藏事件

时间:2018-12-05 10:11:19

标签: ios uikeyboard

是否可以为iOS全局订阅UIKeyboardWillShowNotificationUIKeyboardWillHideNotification?就像用户打开其他应用程序的输入一样,它会显示键盘提示。

目前,我在 didFinishLaunchingWithOptions: 中通过

注册
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(noticeShowKeyboard:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(noticeHideKeyboard:) name:UIKeyboardWillHideNotification object:nil];

但是它仅在我的应用处于活动状态时有效

0 个答案:

没有答案
相关问题