gpt4 book ai didi

iphone - UIKeyboardBoundsUserInfoKey 已弃用

转载 作者:行者123 更新时间:2023-12-03 20:22:05 25 4
gpt4 key购买 nike

我正在尝试使用下面的代码,但是 Xcode 告诉我 UIKeyboardBoundsUserInfoKey 已被弃用,我想知道更新的代码是什么:

NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];

下面是上下文中的代码:

-(void) keyboardDidHide: (NSNotification *)notif {


NSDictionary* info = [notif userInfo];
NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];
CGSize keyboardSize = [aValue CGRectValue].size;
CGRect viewFrame = self.view.frame;
viewFrame.size.height += keyboardSize.height;
scrollView.frame = viewFrame;

if (!keyboardVisible) {
//NSLog(@"Keyboard is already hidden. Ignoring notification.");
return;
}

keyboardVisible = NO;

}

最佳答案

您可以使用 UIKeyboardFrameBeginUserInfoKey 或 UIKeyboardFrameEndUserInfoKey 键代替 UIKeyboardBoundsUserInfoKey。

关于iphone - UIKeyboardBoundsUserInfoKey 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8984551/

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