I defined a custom class with drawRect called Drawing. I set out the view in my NIB to contain an NSScrollView with the Drawing subzone. When I run the program, the screen is blank. Interestingly, when I create a documentView for an NSScrollView programmatically, I get the image in my scroll view. When I use an instance for nib in my setDocumentView, I get nothing.
So, if the drawing view is set to IB,
[_scrollViewWorkspace setDocumentView:_drawing];
But
[_scrollViewWorkspace setDocumentView:[[Drawing alloc] initWithFrame:NSMakeRect(0,0,[[_scrollViewWorkspace documentView ]bounds].size.width, [[_scrollViewWorkspace documentView] bounds ].size.height)]];
It works great!
Why can't I statically bind a drawing object in a NIB?
bc888 source
share