Skip to content

UITextView: isSelectable property ​

The isSelectable property indicates whether the user can select text.

Value ​

A boolean.

ValueEffect
trueThe user can select text
falseText can't be selected
  • Readable and writable.
  • The default value is true.
  • It is linked with isEditable (measured):
WrittenThe other property
isSelectable = falseisEditable also becomes false
isSelectable = trueisEditable is unchanged; it doesn't turn back to true on its own
isEditable = trueisSelectable also becomes true
isEditable = falseisSelectable is unchanged

So for "selectable but not editable", write only isEditable = false.

  • Values of other types are converted to a boolean by truthiness: 0 is false, 'false' is true.
  • There is no change event: only the app's own code changes it.

Examples ​

js
const input = new UITextView();
input.isSelectable = false;
console.log(input.isEditable);

Result: logs false.

Corresponding iOS API ​

UITextView.selectable (the getter is isSelectable).

See also ​