IOS-检测键盘

IOS-检测键盘,ios,Ios,我想知道,当键盘在屏幕上时,我如何在IOS中检测到它。我整天都在工作,但是我不能让它工作。有专门的NSNotification来处理这个问题。您可以添加观察员来收听(不要忘记取消订阅) 然后,您可以通过以下方法处理: - (void)keyboardWillShown:(NSNotification *)notification { // handle } - (void)keyboardWillShown:(NSNotification *)notification { /

我想知道,当键盘在屏幕上时,我如何在IOS中检测到它。我整天都在工作,但是我不能让它工作。

有专门的
NSNotification
来处理这个问题。您可以添加观察员来收听(不要忘记取消订阅)

然后,您可以通过以下方法处理:

- (void)keyboardWillShown:(NSNotification *)notification {
    // handle 
}
- (void)keyboardWillShown:(NSNotification *)notification {
    // handle 
}