Subview displaying outside the bounds of the parent UIView

后端 未结 2 637
日久生厌
日久生厌 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条回答
  • 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

    0 讨论(0)
  • 2021-02-07 00:26

    Programmatically

    [YourSuperview setClipsToBounds:YES]

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