What UIView layer.masksToBounds is doing if set to YES?

前端 未结 1 784
栀梦
栀梦 2020-12-04 12:24

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

相关标签:
1条回答
  • 2020-12-04 13:02

    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).

    0 讨论(0)
提交回复
热议问题