gpt4 book ai didi

iphone - 在显示之前获取键盘的大小

转载 作者:行者123 更新时间:2023-11-29 13:14:29 24 4
gpt4 key购买 nike

我想获取键盘的大小,我是这样操作的:

- (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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com