Subview displaying outside the bounds of the parent UIView

后端 未结 2 668
日久生厌
日久生厌 2021-02-06 23:45

I have a UIView that contain another subview. The subview\'s frame is outside of the bounds of the super view. But the entire subview is visible in when I run the application.

2条回答
  •  萌比男神i
    2021-02-07 00:07

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

    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:

    Clip Subviews checkbox

提交回复
热议问题