cocoa - NSView with layer is drawn over all content -


i have nsview, change properties give make rounded rectangle, gray color, , add view (behind everything)

float gray = 60.0f/255.0f; nsview* background = [[nsview alloc] initwithframe: self.iconcontainer.frame]; calayer *viewlayer = [calayer layer]; [viewlayer setbackgroundcolor:cgcolorcreategenericrgb(gray, gray,gray, 1)]; //rgb plus alpha channel [viewlayer setcornerradius:5.0f]; [background setwantslayer:yes]; // view's backing store using core animation layer [background setlayer:viewlayer];    // place view behind other views [self.iconcontainer addsubview:background positioned:nswindowbelow relativeto:nil]; 

however no matter try, particular view drawn above else.

usually, behaviour caused use of core animation layers on subview, while superview hasn't any.

enabling core animation layers on superview should fix issue, subviews drawn using cora animation layers, making drawing process respect order of subviews.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -