自定义键盘:inputView:如何更改键盘大小? [英] Custom Keyboard: inputView: how to change the Keyboard size?

查看:86
本文介绍了自定义键盘:inputView:如何更改键盘大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有setInputView"功能的自定义键盘实现了文本字段.但我有一个问题:我的键盘框架不是标准的 iPhone 键盘框架.

I implemented the textfield with a custom keyboard with the "setInputView" function. But i have a problem: my keyboard frame is not a standard iphone keybord frame.

问题是:如何更改自定义键盘的大小?我知道一些函数,例如:UIKeyboardFrameBeginUserInfoKey、..etc.

The question is: How can i change the size of my custom keyboard? I know some functions like: UIKeyboardFrameBeginUserInfoKey, ..etc.

请注意:iPhone 键盘框架是 = 0,264,320,216我的自定义键盘框架是 = 0,0,320,460

Please Note: The iPhone keyboard frame is = 0,264,320,216 My custom keyboard frame is = 0,0,320,460

希望您的友好合作,此致...

Hoping for your kind collaboration, Best regards... P

推荐答案

事实证明,您分配给 UITextField 属性的自定义输入视图的默认行为是调整视图大小到与默认键盘相同的框架.尝试设置(我使用名称 InputViewController 作为我的输入视图,但你可以使用任何你想要的):

It turns out that the default behaviour of the custom input view that you assign to the UITextField's property is to resize the view to the same frame as the default keyboard. Try setting (I use the name InputViewController for my input view, but you can use whatever you want):

inputViewController = [[InputViewController alloc] initWithNibName:@"InputViewController" bundle:nil];
inputViewController.delegate = self;
inputViewController.view.autoresizingMask = UIViewAutoresizingNone; // This is the code that will make sure the view does not get resized to the keyboards frame.

更详细的信息可以查看此链接,由 Apple 提供.:

For more detailed information, you can look at this link, which is provided by Apple.:

如果 UIKit 在其自动调整大小掩码中遇到带有 UIViewAutoresizingFlexibleHeight 值的输入视图,它会更改高度以匹配键盘.

If UIKit encounters an input view with an UIViewAutoresizingFlexibleHeight value in its autoresizing mask, it changes the height to match the keyboard.

希望有帮助!

这篇关于自定义键盘:inputView:如何更改键盘大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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