I have a simple layout, which consists of NSView and its subview NSTextView. NSTextView is programmatically filled with some text that spawns multiple lines. I tie everything together using auto-layout (all done programmatically). However, when everything is displayed NSTextView is cut off, only one line is showing.
After searching the web, the best answer I could find was:
Using Autolayout with expanding NSTextViews
However, this only works if I manually change the text in NSTextView after everything is displayed (which is not really my use case). The views are readjusted and the whole NSTextView is displayed.
I am trying to figure out when NSViewController is done with laying out subviews so that I could call invalidateIntrinsicContentSize
on the NSTextView. The equivalent of viewDidLayoutSubviews
in UIViewController.
Nothing I tried worked so far. I attempted calling invalidateIntrinsicContentSize
for NSTextView:
- At the end of
loadView
- After I filled NSTextView with my text
Is there a better way to achieve this?