clip to bounds 和mask to bounds的区别

UIView.clipsToBounds 让子 View 只显示落在父 View 的 Frame 部分;是子视图超出不现实,默认为NO,设置为YES就会把超出的部分裁掉。

maskToBounds 是 CALayer 的属性,基于 View  的不少属性其实就是作用于 CALayer 的。子图层是否剪切图层边界,默认为NO

blueView.layer.maskToBounds = YES 与 blueView.clipToBounds = YES 的效果是一样的,随便设置哪个属性都可。

原文地址:https://www.cnblogs.com/linxiu-0925/p/5500399.html