如果设置为YES,UIView layer.masksToBounds正在做什么? [英] What UIView layer.masksToBounds is doing if set to YES?

查看:152
本文介绍了如果设置为YES,UIView layer.masksToBounds正在做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道吗?我找到了一些答案,但是太复杂而且太深了。我需要一个简单的答案。

Anyone know? I found a few answers, but there were too complex and going too deep. I need a simple answer.

推荐答案

如果设置了 masksToBounds 属性为YES,层的任何子层在其边界之外延伸将被剪切到这些边界。在这种情况下,将层视为其子层的窗口;窗口边缘以外的任何东西都不可见。当 masksToBounds 为NO时,不会发生剪裁,并且任何延伸到图层边界外的子图层都将完整可见(只要它们不会超出边缘任何启用了遮罩的超级图层。)

If the masksToBounds property is set to YES, any sublayers of the layer that extend outside its boundaries will be clipped to those boundaries. Think of the layer, in that case, as a window onto its sublayers; anything outside the edges of the window will not be visible. When masksToBounds is NO, no clipping occurs, and any sublayers that extend outside the layer's boundaries will be visible in their entirety (as long as they don't go outside the edges of any superlayer that does have masking enabled).

这篇关于如果设置为YES,UIView layer.masksToBounds正在做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆