如何像 gBoard 在他们的键盘中所做的那样自定义键盘大小(参见屏幕截图)。
这里的搜索部分显示在键盘上方。我想在我的应用程序中做同样的事情。有没有人可以帮助我知道使用哪种方法来创建这样的 View 。
最佳答案
你应该看看 inputAccessoryView
属性(property)。因为它是 UIResponder
上的属性,可在 UITextView
, UITextField
和别的。将您的自定义 View 分配给 inputAccessoryView
只要您分配给它的 UI 对象具有焦点,它就会出现在键盘顶部。
// Create your custom keyboard accessory view first
// then assign it
yourTextField.inputAccessoryView = yourCustomAccessoryView;
// Bring up keyboard and your accessory view
[yourTextField becomeFirstResponder];
在这里阅读更多
https://developer.apple.com/library/content/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/InputViews/InputViews.html
inputAccessoryView
Assigning a view to this property causes that view to be displayed above the standard system keyboard (or above the custom input view if one is provided) when the text view becomes the first responder. For example, you could use this property to attach a custom toolbar to the keyboard.
关于ios - 自定义键盘高度大于默认键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48802380/