Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable editing in NSTextView

I am trying to disable editing in NSTextView but there doesn't seem to be any option there.All the other types have enabled property which when set to false are non editable but is there any for NSTextView?

like image 790
Zeist Avatar asked Apr 01 '15 11:04

Zeist


2 Answers

Please do not forget that a class inherits the methods of its superClass. The superClass of NSTextView is NSText. And there you find the method

  • (void)setEditable:(BOOL)flag

with the comment:

Controls whether the receiver allows the user to edit its text.
like image 147
Heinrich Giesen Avatar answered Nov 09 '22 19:11

Heinrich Giesen


For SWIFT3, you need to set isEditable to false.

var isEditable: Bool A Boolean value that controls whether the text views sharing the receiver’s layout manager allow the user to edit text.

https://developer.apple.com/documentation/appkit/nstextview#overview

like image 1
Ham Dong Kyun Avatar answered Nov 09 '22 17:11

Ham Dong Kyun