且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

子视图显示在父UIView的边界之外

更新时间:2022-05-17 10:23:14

如果你'在代码中重新设置视图,将超级视图的 clipsToBounds 属性设置为 YES

If you're setting up your views in code, set the clipsToBounds property of the superview to YES.

如果您要在笔尖中设置视图,请在超级视图上选中 on 剪辑子视图复选框。它默认是关闭的,如截图所示:

If you're setting up your views in a nib, turn on the "Clip Subviews" checkbox on the superview. It's off by default, as in this screenshot: