Ios 键盘检测

Ios 键盘检测,ios,keyboard,Ios,Keyboard,我想在键盘显示时在我的应用程序中运行一个方法。 是否有预定义的方法或我必须创建它? 以及如何创建它?当键盘将要显示时,您可以收到一个通知: UIKeyboardWillShowNotification UIKeyboardDidShowNotification 您可以按如下方式注册通知: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)

我想在键盘显示时在我的应用程序中运行一个方法。 是否有预定义的方法或我必须创建它?
以及如何创建它?

当键盘将要显示时,您可以收到一个通知:

UIKeyboardWillShowNotification
UIKeyboardDidShowNotification
您可以按如下方式注册通知:

[[NSNotificationCenter defaultCenter] addObserver:self
        selector:@selector(keyboardWillShow:)
        name:UIKeyboardWillShowNotification object:nil];
更多