使NSView不在范围内裁剪子视图 [英] Make NSView NOT clip subviews outside of its bounds
本文介绍了使NSView不在范围内裁剪子视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使NSView
not 剪辑其边界之外的子视图?在iOS上,我只需将UIView
的clipsToBounds
设置为NO
.但是NSView
没有这样的属性.我尝试使用wantsLayer
,masksToBounds
,wantsDefaultClipping
进行实验,但所有这些似乎仅更改了drawRect
方法的裁剪,而不是子视图.
Is it possible to make an NSView
not clip its subviews that are outside of the bounds? On iOS I would simply set clipsToBounds
of my UIView
no NO
. But NSView
doesn't have such a property. I tried experimenting with wantsLayer
, masksToBounds
, wantsDefaultClipping
, but all of these seem to only change the clipping of the drawRect
method, not the subviews.
推荐答案
我能够通过覆盖子视图的wantsDefaultClipping
以返回NO
来解决此问题.
I was able to solve this by overriding wantsDefaultClipping
of the subviews to return NO
.
这篇关于使NSView不在范围内裁剪子视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文