Search code examples
cocoanstableviewnsviewnstextfieldnstextview

How to add an NSTextView with changing height inside an NSTableView


I have an NSTextView inside an NSTableView. I would like the NSTextView to be editable in such a way that when I add content to it, the NSTableView and NSTableCellView resizes to show the full content of the NSTextView.

Example of this behaviour from Omnifocus

enter image description here


Solution

  • I have to use NSTableView's noteHeightOfRowChangedWithIndexes along with controlTextdidChange in order to achieve the desired effect.