开发者

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:

Can UIView's children be constrained to their parent's frame

Can UIView's children be constrained to their parent's frame

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜