Can UIView's children be constrained to their parent's frame
I have a custom UIView
that acts as a layout object. If I add children to that UIView
(layout), the layout takes care of their positioning (using the layoutSubviews
method). Is it possible to constrain the children in such a way, so that they are not drawn outside the layout's bounds?
Below is an illustration of what I want to achieve:
The left picture is what would normally happen. I want to achieve the situation in the right picture.
Please note, I do not want to redraw over the Button, I just want it not to be drawn outside its parent.
Is this p开发者_Go百科ossible and how?
Set your parent view clipsToBounds
property to YES
精彩评论