我正在构建一个 ipad 应用程序,
它有一些文本字段,当点击时,它们会移动到键盘上方,
如果点击“计算”按钮,键盘和 View ,向下,
但是如果用户从 ipad 上点击隐藏键盘 [键盘右下角的键]
我的观点仍然高涨,
那么,我如何以编程方式知道“隐藏键盘”已被点击?
非常感谢!
最佳答案
您应该使用通知中心来跟踪键盘,
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(didShow) name:UIKeyboardDidShowNotification object:nil];
[center addObserver:self selector:@selector(didHide) name:UIKeyboardWillHideNotification object:nil];
//Resize your views in the below methods
- (void)didShow
{
}
- (void)didHide
{
}
关于ios - ipad怎么知道键盘被隐藏了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7912246/