gpt4 book ai didi

iphone - 键盘通知未正确触发

转载 作者:行者123 更新时间:2023-12-03 21:14:49 26 4
gpt4 key购买 nike

我试图在键盘即将显示时收到通知,但目前它在显示键盘后触发。

这是我的通知注册:

[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector (keyboardDidShow:)
name: UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector (keyboardDidHide:)
name: UIKeyboardDidHideNotification
object:nil];

最佳答案

尝试使用这个:

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

UIKeyboardDidShowNotification 更改为 UIKeyboardWillShowNotification

关于iphone - 键盘通知未正确触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25669718/

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