检查分离键盘 [英] Check for split keyboard

查看:103
本文介绍了检查分离键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多人都知道iOS 5引入了一个用于拇指键入的光滑分离键盘。不幸的是,我有一些依赖于普通全屏键盘布局的UI。我的一个视图控制器向用户显示文本输入表,如果他们点击键盘覆盖的textField,它会随键盘一起向上滑动。拆分键盘不需要此操作。

As many of you know iOS 5 introduced a slick split keyboard for thumb-typing. Unfortunately, I have some UI that is dependent on the normal full-screen keyboard layout. One of my view controllers presents the user with a text entry sheet, and if they click into a textField that would be covered by the keyboard, it slides up along with the keyboard. This action is unnecessary with the split keyboard.

有没有办法在弹出之前检查哪个键盘布局正在使用?

Is there a way to check which keyboard layout is in use before it pops up?

谢谢!

推荐答案

当键盘停靠时,将引发 UIKeyboardWillShowNotification 。如果键盘被拆分或取消停靠,则不会引发键盘通知。

When the keyboard is docked, UIKeyboardWillShowNotification will be raised. If the keyboard is split or undocked, no keyboard notifications are raised.

如果键盘停靠, UIKeyboardWillShowNotification 将被提出,以下情况属实:

If a keyboard is docked, UIKeyboardWillShowNotification will be raised, and the following will be true:

[[[notification userInfo] valueForKey:@"UIKeyboardFrameChangedByUserInteraction"] intValue] == 1

如果键盘未对接, UIKeyboardWillHideNotification 将被提出,上述声明也将成立。

If a keyboard is undocked, UIKeyboardWillHideNotification will be raised, and the above statement will also be true.

使用此信息足以让我编写用户界面代码。

Using this information has been adequate for me to code my user interface.

注意:这可能违反了Apple的指导方针,我不确定。

Note: this might be a violation of Apple's guidelines, I'm not sure.

这篇关于检查分离键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆