如何在 iOS 15 上隐藏建议栏?

发布于 2025-01-11 05:29:20 字数 660 浏览 5 评论 0原文

我有一个 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.

keyboard

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

差↓一点笑了 2025-01-18 05:29:20

我认为您缺少 spellCheckingType

这对我有用:

self.autocorrectionType = UITextAutocorrectionTypeNo;
self.spellCheckingType = UITextSpellCheckingTypeNo;

I think you're missing spellCheckingType!

This works for me:

self.autocorrectionType = UITextAutocorrectionTypeNo;
self.spellCheckingType = UITextSpellCheckingTypeNo;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文