如何检测键盘类型随新键盘类型的大小、类型、提示栏高度的变化? [英] How to detect keyboard type changes with the size, type, suggestion bar height of new keyboard type?

查看:37
本文介绍了如何检测键盘类型随新键盘类型的大小、类型、提示栏高度的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以检测键盘类型随大小、类型和建议栏高度的变化,比如从英文键盘更改为包含某种建议栏的印地语(见截图).

Is there any way to detect keyboard types changes with the size, type and suggestion bar height, change like from English keyboard to Hindi which contains some kind of suggestion bar (see screenshot).

普通英文键盘

第一个问题

更改为印地语 LIPI 后 - 当我刚刚更改时,一切都很好,因为英语和印地语键盘的大小相同,但是在开始输入印地语 Lipi 后,建议覆盖 TextField

After changing to Hindi LIPI - When just I changed, everthing is fine because size of english and hindi keyboard is same, but after start typing Hindi Lipi suggestion cover the TextField

第二个问题

更改为表情符号后 - 表情符号键盘比英语高一点,所以键盘再次覆盖了TextField.

After changing to Emoji - Emoji keyboard hight little bit more as compare to english, So again keyboard cover the TextField.

推荐答案

为名为UIKeyboardWillChangeFrameNotification"的通知添加观察者.

Add an observer for a notification named "UIKeyboardWillChangeFrameNotification".

通知的userInfo"字典在屏幕上有多个键盘框架.

The "userInfo" dictionary for the notification has multiple frames of the keyboard on the screen.

添加观察者

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(logNotification:) name:UIKeyboardWillChangeFrameNotification object:nil];

带有记录器的选择器

- (void)logNotification:(NSNotification *)notification {

    NSLog(@"%@", notification);
}

userInfo 字典内容

userInfo = {
    UIKeyboardAnimationCurveUserInfoKey = 7;
    UIKeyboardAnimationDurationUserInfoKey = 0;
    UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 216}}";
    UIKeyboardCenterBeginUserInfoKey = "NSPoint: {160, 441.5}";
    UIKeyboardCenterEndUserInfoKey = "NSPoint: {160, 460}";
    UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 315}, {320, 253}}";
    UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 352}, {320, 216}}";
    UIKeyboardIsLocalUserInfoKey = 1;
}}

这篇关于如何检测键盘类型随新键盘类型的大小、类型、提示栏高度的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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