Post

Replies

Boosts

Views

Activity

Reply to NSTextView subclass not displaying text in Sonoma
Update: Issue fixed. Initially I thought it was a clipsToBounds issue on a programmatically created ruler used to display line numbers. This wasn't showing up in XIB because the line numbers aren't always displayed. So setting the ruler's clipsToBounds seemed like the solution. rulerView.clipsToBounds = YES; And it does fix the problem, but something felt off. I rewatched the "What's new in AppKit" from WWDC23 and there was an emphasis that we likely did not need to use clipsToBounds except in very specific cases. So I reviewed the ruler drawing code and found that it was actually using the dirtyRect parameter instead of its bounds when filling the background. Clearly, dirtyRect was much bigger now, but when clipsToBounds = YES, it essentially keeps the fill limited to the bounds, but it hid the root cause of the problem. In the end, the better solution was to fix the drawing code to use its bounds instead of the dirtyRect, so it works regardless of whether clipsToBounds is true or false.
Oct ’23