Iphone – UIView hide children views when out of bounds

iphoneuiviewvisibility

I have a view, lets say 100×100. And it has set of uiviews as subviews: let say 30×30

If a subview has top-left coordinate: (90,90) – I expect to see only part of this subview. But I still see entire area – even if it is out of parents bounds

The question is how to make uiview to show only those parts of subview, which are in original bounds?

thank you

Best Answer

Set the parent view's clipsToBounds property to YES.

Programmatically: view.clipsToBounds=YES;

Through interface builder: Click the view->Attributes Inspector->Check Clip to Bounds

Related Topic