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

查看:21
本文介绍了如果设置为 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天全站免登陆