I have a transparent .png
image that lays over an NSView
and it should look like this:
However, sometimes, with no rhyme or reason or indication that it is going to do this, the NSImageView
falls behind the NSView
:
I am not sure how to keep the NSImageView
above the NSView
, or why it even falls behind the NSView
.
Here is what it looks like in Interface Builder:
Update:
I have tried the following with same results:
[header removeFromSuperview];
[mainView addSubview:header positioned:NSWindowAbove relativeTo:nil];
What is a better way to achieve this effect?
Cocoa UI elements that overlap have an undefined drawing order, and Apple states that you shouldn't overlap them. You could create some custom drawing code to make your current design work. However, honestly I would change the design so it matches with Mac OS X's human interface guidelines. You can read about these at the link below. http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/XHIGIntro.html%23//apple_ref/doc/uid/TP30000894-TP6