gpt4 book ai didi

iphone - 在 windowLevel 大于 UIWindowLevelAlert 的 UIWindow 中使用时,键盘关闭时没有动画

转载 作者:可可西里 更新时间:2023-11-01 05:36:05 24 4
gpt4 key购买 nike

我目前正在展示一个安全代码 View Controller ,其中包含一个用户应该在其中输入密码的 UITextField。此安全代码 View Controller 显示在其自己的窗口中,该窗口具有“windowLevel = UIWindowLevelAlert + 1;”因为我想隐藏潜在的 UIAlertView 或其他可能已经显示的窗口。

当我在文本字段上调用 ​​resignFirstResponder 方法时,问题就来了,键盘似乎在没有通常的动画的情况下被关闭了。我尝试注册各种键盘通知,并检查了 UIView areAnimationsEnabled 属性,它返回 YES。

所以如果有人遇到过这个问题,不客气:)

最佳答案

UIKeyboardAnimationDurationUserInfoKey 是动画持续时间的常量字符串标识符,因此有启用和禁用动画的位置。

[[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(willHideKeyboard:)
name:UIKeyboardWillHideNotification
object:nil];

- (void)willHideKeyboard:(NSNotification *)notification {
[UIView setAnimationsEnabled:NO];
}

关于iphone - 在 windowLevel 大于 UIWindowLevelAlert 的 UIWindow 中使用时,键盘关闭时没有动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18667966/

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