当文本被选中时,我无法删除此勾选符号,我尝试了以下方法:
class CustomUITextField: UITextField { open override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { return false } }
删除了复制、粘贴等功能,但似乎没有删除iOS 16的新功能。感谢您的帮助:)
8mmmxcuj1#
您可以尝试:
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder API_AVAILABLE(ios(13.0)) { if (@available(iOS 16.0, *)) { [builder removeMenuForIdentifier:UIMenuLookup]; } [super buildMenuWithBuilder:builder]; }
zbq4xfa02#
将以下代码添加到自定义子类中:
@available(iOS 13.0, *) override func buildMenu(with builder: UIMenuBuilder) { builder.remove(menu: .lookup) super.buildMenu(with: builder) }
2条答案
按热度按时间8mmmxcuj1#
您可以尝试:
zbq4xfa02#
将以下代码添加到自定义子类中: