UIMenuItem 上该段的名称是什么?

发布于 2024-11-08 04:46:48 字数 240 浏览 2 评论 0原文

UIMenuItem

我知道 UIMenuController 可以显示包含剪切、复制、粘贴、选择/的弹出窗口所有和其他系统菜单项。但我不知道最后一项是什么,如上面的屏幕截图所示。它的作用是什么?它是否调用应用程序内的任何内容?如果是,是什么?可以禁用吗?在这种情况下,我想以编程方式禁用或删除该项目,而不禁用任何国际键盘。

UIMenuItem

I know that the UIMenuController can show a popover containing Cut, Copy, Paste, Select/All, and other system menu items. But I don't know what the last item is, visible in the screenshot above. What is its function? Does it call anything within the application, and if so, what? Can it be disabled? In this case, I would like to disable or remove the item programmatically, without disabling any international keyboards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

記憶穿過時間隧道 2024-11-15 04:46:48

假设您正在谈论以编程方式禁用 RTL 菜单项而不禁用国际键盘,那么您似乎无法做到这一点 - 至少在使用 UIMenuController 时不能。 如果您查看其 文档menuItems 属性,它解释了可以在系统项目之后插入自定义项目,但没有表明您可以删除由于某种原因不需要的那些系统项目。

点击它可能会导致 iOS 调用 UITextInput 协议的 setBaseWritingDirection:forRange: 方法。不过,我对此一无所知——我只能猜测,因为在短暂浏览文档后我没有意识到对此有明确的解释。

Assuming you are talking about disabling the RTL menu item programmatically without disabling international keyboards, it doesn't appear that you can - at least not while using UIMenuController. If you look at the documentation for its menuItems property, it explains that custom items can be inserted after system items, but makes no indication that you can remove those system items that you for some reason do not want.

Tapping it might result in iOS calling the UITextInput protocol's setBaseWritingDirection:forRange: method. I don't know about that, though – I can only guess since there's no clear explanation of this that I'm aware of after a short run around the documentation.

眼眸印温柔 2024-11-15 04:46:48

图中最右边的“箭头”UIMenuItem 确实是一个系统项。它的选择器称为 _setRtoLTextDirection: 或 _setLtoRTextDirection: 我怀疑苹果不希望你搞乱它们,因为当你尝试输入这些方法。

要禁用它们,请检查它们并在覆盖的 - (BOOL)canPerformAction:(SEL)action withSender:(id)sender 方法中返回“NO”。

对于想要禁用 UIMenuItemController 中默认 UIMenuItems 的任何人,您可以在我的 博客

That right-most "arrow" UIMenuItem pictured is indeed a system item. The selector for it is called _setRtoLTextDirection: or _setLtoRTextDirection: I suspect apple wouldn't want you messing with them as the auto-complete in Xcode doesn't help you when you try to type these methods.

To disable them, check for them and return "NO" in your overridden - (BOOL)canPerformAction:(SEL)action withSender:(id)sender method.

For anyone else that wants to disable the default UIMenuItems in the UIMenuItemController, you can find the complete list (or most of them at least) in my blog.

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