用户登录
用户注册

分享至

检查拆分键盘

  • 作者: 黄某某007
  • 来源: 51数据库
  • 2023-02-09

问题描述

正如许多人所知,iOS 5 引入了用于拇指打字的灵巧拆分键盘.不幸的是,我有一些 UI 依赖于正常的全屏键盘布局.我的一个视图控制器向用户提供了一个文本输入表,如果他们单击一个将被键盘覆盖的文本字段,它会与键盘一起向上滑动.拆分键盘不需要此操作.

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.

软件
前端设计
程序设计
Java相关