2012-10-08 198 views
1

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

回答

2

你可以当键盘将会显示一个通知:

UIKeyboardWillShowNotification 
UIKeyboardDidShowNotification 

你可以像这样的注册通知:

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

更多here