I'm programming an OS X application in XCode using Swift 3 and the storyboard functionality.
I have text that gets loaded dynamically (size is not pre-defined) in a NSTextView inside a NSClipView inside a NSScrollView. The problem is that this text gets clipped when it's bigger than the size of the NSClipView and no scrollbar appears. What am I missing?
The storyboard with constraints. The "No Lyrics" cell defines the NSTextView where the text will be loaded into.
@IBOutlet weak var lyricsTextField: NSTextField!
@IBOutlet weak var lyricsClipView: NSClipView!
@IBOutlet weak var lyricsView: NSView!
@IBOutlet weak var lyricsScrollView: NSScrollView!
// This method gets called every time the string value changes
func updateForTrack() {
lyricsTextField.stringValue = trackManager.currentLyrics
// Some things I tried without any success
lyricsTextField.sizeToFit()
print(lyricsTextField.frame.size) // the size is correct (not clipped)
lyricsClipView.documentView?.setFrameSize(lyricsTextField.frame.size)
lyricsScrollView.documentView?.setFrameSize(lyricsTextField.frame.size)
}
And the result:
The view is not scrollable.
I would appreciate any hint in the right direction.