キーボードのサイズを取得したいのですが、次のようにします。
- (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」メソッドが呼び出される前) にサイズを取得したいと考えています。どうすればいいですか?