1

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

4

1 回答 1

2

您可以在键盘出现时收到通知:

UIKeyboardWillShowNotification
UIKeyboardDidShowNotification

您可以像这样注册通知:

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

更多在这里

于 2012-10-08T11:03:14.987 回答