我想获取键盘的大小,并按如下方式进行操作:
- (void)viewDidLoad
{
....
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
....
}
//I can get the size here
- (void)keyboardWillShow:(NSNotification *)notification
{
NSDictionary *userInfo = [notification userInfo];
NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [aValue CGRectValue];
}
但是现在,我想在显示键盘之前获取大小(在调用“keyboardWillShow”方法之前)。我该怎么做?
最佳答案
实际上,在显示键盘之前会触发- (void)keyboardWillShow:(NSNotification *)notification;
方法。
关于iphone - 在显示键盘之前获取其大小,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16185051/