如何在 iOS 15 上隐藏建议栏?
我有一个 OpenGL 窗口,当在我们的引擎中单击文本元素时,该窗口也用于文本输入。
@interface MyGLView : UIView <UIKeyInput, UITextInput, UITextInputTraits>
每当此视图成为第一响应者时,它都会在键盘上方显示建议栏。在许多设备上,这会覆盖屏幕的很大一部分,并且很难布置 UI。
我已读到以下代码应该隐藏此建议栏,但我所做的任何更改似乎都没有任何影响
self.autocorrectionType = UITextAutocorrectionTypeNo;
self.inputAssistantItem.leadingBarButtonGroups = @[];
self.inputAssistantItem.trailingBarButtonGroups = @[];
我尝试将其放入视图的 init 以及becomeFirstResponder 方法中,但两者都似乎并不重要。执行此操作的正确方法是什么?
I have on OpenGL window that is also used for text input when a text element is clicked in our engine
@interface MyGLView : UIView <UIKeyInput, UITextInput, UITextInputTraits>
Whenever this view becomes first responder, it shows the suggestion bar above the keyboard. On many devices, this covers a very large portion of the screen and makes it hard to lay out the UI.
I have read that the following code is supposed to hide this suggestion bar, but nothing I change seems to have any affect
self.autocorrectionType = UITextAutocorrectionTypeNo;
self.inputAssistantItem.leadingBarButtonGroups = @[];
self.inputAssistantItem.trailingBarButtonGroups = @[];
I have tried putting this in the init for the view as well as in becomeFirstResponder method, but both don't seem to matter. What is the proper way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您缺少 spellCheckingType!
这对我有用:
I think you're missing spellCheckingType!
This works for me: