Objective-c – Handwired NSTextView clipping bug

cocoamacosobjective c

I'm trying to assemble a NSTextView by hand as in Apple's TextSizingExample and found a boring bug. If you run TextSizingExample and select "Wrapping Scrolling Text" mode, then you'll see the text being partially hidden by a vertical scrollbar. Tried to play with the size and autoresizing mask of text container and text view but it didn't help.

Best Answer

The problem is in the VerticalScrollAspect class's naive approach to creating the scroll view. In the -containerView method, there is the following line:

scrollView = [[NSScrollView alloc] initWithFrame:[documentView frame]];

Unfortunately, this does not account for the width of the vertical scroll bar or the border style of the scroll view, both of which are important to consider.

Related Topic