textfield - 自定义键盘 : inputView: how to change the Keyboard size?

标签 textfield uikeyboard inputview

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

问题是:
如何更改自定义键盘的大小?
我知道一些功能,例如:UIKeyboardFrameBeginUserInfoKey,.. 等。

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

期待您的友好合作,
此致...

最佳答案

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

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.

更多详细信息可以查看this link ,由 提供苹果 .:

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



希望有帮助!

关于textfield - 自定义键盘 : inputView: how to change the Keyboard size?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6042060/

相关文章:

iphone - UITextField inputview 属性拉出自定义 UIPickerView 时出现问题

xcode - Xcode 11 Beta 5 中的 API 更改后,如何在 SwiftUI 中为 TextField 使用 RoundedBorderTextFieldStyle?

iOS - Twitter like 联系人选择

ios - 单击 UIWebView 的文本输入时键盘不可见

iOS - 关闭显示为 inputView 的 UIDatePicker

ios - 以编程方式设置文本时,UITextField 占位符在 UI​​TextField.text 后面显示有阴影。为什么?

java - 未检测到文本字段和密码字段

css - 液体文本字段宽度

Android软键盘不平移 WebView

ios - 显示键盘时,Popover 内的 UIScrollView 内的 UITextView 不完全可见