Growing NSTextView to fit contents is clipping last line of text
I'm trying to create an NSTextView that grows vertically as the user types and scrolls once the height has reached a maximum. This is similar to the text view in Messages works. My first attempt uses the delegate to listen for text changes and adjust the height constraint associated with the NSTextView's scroll view: - (void)textDidChange:(NSNotification *)notification { NSTextView *textView = self.textView; NSRect usedRect = [textView.textContainer.layoutManager usedRectForTextContainer:textView.textContainer]; NSLog(@"DEBUG: used rect: %@", NSStringFromRect(usedRect)); self