Unable to disable cropping of NSView instances created in Interface Builder

I cannot figure out how to disable subview / sublayer clipping when my custom view is defined in Interface Builder. When I create a view programmatically and do the customization found in many of the questions here in StackOverflow, it works great for both the subheadings added to the view and the sublayers added to view.layer. That's what:

((NSView*)containingWindow.contentView).wantsLayer = YES; view.wantsLayer = YES; view.layer.masksToBounds = NO; 

Once they are executed (in that order), everything works fine for the views created in the code. If I do the same (or something else, for that matter) for performances created in IB, I cannot go anywhere.

I tried using a custom NSView that defines a method:

 - (CALayer*)makeBackingLayer { CALayer* layer = [CALayer layer]; layer.masksToBounds = NO; return layer; } - (BOOL)wantsDefaultClipping { return NO; } 

Does not help. I also tried to check the checkbox in the "Core Animation Layer" section in the effects view in IB. It didn’t help either. Finally, I tried to disable the restrictions, just in case it was responsible. Does not work.

Any help is appreciated. One thing I notice is that my view of the "masksToBounds" support layer starts with NO, as I set it, but when I register the view hierarchy later, it becomes YES on the same view (confirmed by its memory address. )

+8
objective-c interface-builder nsview clipping
source share
1 answer

Try:

 myView.wantsDefaultClipping = NO; 

and do it also for child views.

-3
source share

All Articles