All Articles

remove past/copy action of UITextView

override this function in UITextView subclass.

override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { switch action { case #selector(UIResponderStandardEditActions.paste(_:)), #selector(UIResponderStandardEditActions.select(_:)), #selector(UIResponderStandardEditActions.selectAll(_:)), #selector(UIResponderStandardEditActions.copy(_:)), #selector(UIResponderStandardEditActions.cut(_:)), #selector(UIResponderStandardEditActions.delete(_:)) : return false default: return true } return false }