【发布时间】:2013-02-19 14:00:15
【问题描述】:
如何找到UIKeyboard 在我的应用程序中是否打开?
我不想使用UITextField 的任何委托方法。
请提出任何解决方案。
提前致谢。
【问题讨论】:
标签: iphone ios objective-c cocoa-touch uikeyboard
如何找到UIKeyboard 在我的应用程序中是否打开?
我不想使用UITextField 的任何委托方法。
请提出任何解决方案。
提前致谢。
【问题讨论】:
标签: iphone ios objective-c cocoa-touch uikeyboard
测试一下:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
【讨论】:
使用键盘通知检查UIKeyBoard 的状态。
键盘通知:
当系统显示或隐藏键盘时,它会发布多个键盘通知。这些通知包含有关键盘的信息,包括其大小,您可以将其用于涉及移动视图的计算。注册这些通知是获取有关键盘的某些类型信息的唯一方法。系统会针对键盘相关事件提供以下通知:
UIKeyboardWillShowNotification
UIKeyboardDidShowNotification
UIKeyboardWillHideNotification
UIKeyboardDidHideNotification
【讨论】: