gpt4 book ai didi

iphone - 键盘隐藏之前的通知?

转载 作者:行者123 更新时间:2023-11-29 03:50:41 27 4
gpt4 key购买 nike

我试图在键盘隐藏之前收到通知。我已经尝试过可用的通知,但它们似乎都在键盘从屏幕上消失时调用。我需要在键盘开始向下滑动之前运行代码。

最佳答案

观察通知:

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

方法:

- (void)keyboardWillShow:(NSNotification *)notification {
}
- (void)keyboardWillHide:(NSNotification *)notification {
}

隐藏键盘需要 0.25 或 0.3。如果您需要在隐藏之前执行操作,只需将计时器设置为 0.2,在完成操作之前您将有 0.1。

关于iphone - 键盘隐藏之前的通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17118230/

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