The problem is auto layout. Turn it off and it will work fine.
Can't get View to be drawn in NSScrollView
-
01-07-2022 - |
Question
I am confused about how to implement a NSScrollView
in the most basic way, so I will describe exactly what I do and hope that it is just to late for me to find my error:
- Create Xcode project.
- Adding a NSScrollView into MainMenu.xib.
Creating new class inherited from NSView with the drawing method:
(void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; [[NSColor redColor] set]; NSRectFill(dirtyRect); }
Define the view of the NSScrollView to be that new class.
I expected to see a NSScrollView with a red background. Instead, I see the scroll view with no modification.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow