I have the following code attached to an NSButton
- (IBAction) onTest: (id) sender
{
NSLog(@"OnTest");
[overlayView setFrame: scrollView.frame];
[scrollView.superview addSubview: overlayView];
}
My nib is setup as the following picture:
The scrollView outlet is attached to the NSScrollView
that encloses a NSTableView
and the overlayView is attached to a NSView
that has a green background.
On the click of a button, I receive the OnTest
log message in xcode, but the green view is not visible, however if I switch focus from the applications window to say XCode, then back to the window, the green overlay is now visible.
I've tried using [scrollView.superView setNeedsDisplay: YES]
, but that still does not cause the green view to be displayed.
Any suggestions as to that I'm doing wrong?