I have a UITextField in my Swift iOS app. How do I make it copyable, but not editable?
Here's what I've tried:
What should I do?
Use UITextView instead of UITextField. UITextField does not have an isEditable property. The following Swift 5 code shows a possible implementation of a UITextView instance that matches your requirements:
textView.isUserInteractionEnabled = true
textView.isEditable = false
According to the documentation, isUserInteractionEnabled determines whether user events are ignored and removed from the event queue and isEditable indicates whether the receiver is editable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With