gpt4 book ai didi

ios - 如何禁用替换、插入绘图、查找、学习、说话、说话..、在 UI 文本字段上暂停?

转载 作者:行者123 更新时间:2023-11-28 13:45:06 37 4
gpt4 key购买 nike

我在 uipickerview 中有一个 uitextfield,我试图禁用任何类型的格式,我使用 UIResponderStandardEditActions 来禁用随之而来的所有操作,但我不知道如何禁用替换,在文本字段上插入绘图、查找、学习、说话和暂停。

在 UITextfield 上禁用格式

override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
if action == #selector(cut(_:)) ||
action == #selector(copy(_:)) ||
action == #selector(UIResponderStandardEditActions.paste(_:)) ||
action == #selector(UIResponderStandardEditActions.select(_:)) ||
action == #selector(UIResponderStandardEditActions.selectAll(_:)) ||
action == #selector(UIResponderStandardEditActions.delete(_:)) ||
action == #selector(UIResponderStandardEditActions.toggleBoldface(_:)) ||
action == #selector(UIResponderStandardEditActions.toggleItalics(_:)) ||
action == #selector(UIResponderStandardEditActions.toggleUnderline(_:)) ||
action == #selector(UIResponderStandardEditActions.increaseSize(_:)) ||
action == #selector(UIResponderStandardEditActions.decreaseSize(_:)) ||
action == #selector(UIResponderStandardEditActions.makeTextWritingDirectionLeftToRight(_:)) ||
action == #selector(UIResponderStandardEditActions.makeTextWritingDirectionRightToLeft(_:))
{
return false
}
return true
}

最佳答案

不要试图列出所有可能返回 false 的选择器。颠倒你的逻辑。如果选择器是您要启用的菜单项的选择器,则返回 true。否则返回假。

关于ios - 如何禁用替换、插入绘图、查找、学习、说话、说话..、在 UI 文本字段上暂停?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55498297/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com