views:

1366

answers:

1

The documentation says that the clipsToBounds property of UIView will clip the drawing to the bounds, or more precisely that the subview can't draw outside of the bounds of the superview.

Sounds nice, but what does that mean in practise? If I set that to YES, then my subview will automatically only draw those parts which are not outside the bounds of the superview, so it increases the overall performance? Or do I still have to make sure that I don't create any views that are not visible, i.e. inside a UIScrollView?

+4  A: 

I think it's the opposite: turning on clipping hurts performance because it has to set up a clipping mask. I vaguely remember reading this somewhere, but I can't find it now.

Daniel Dickison
I think you're right. Simply put, the OS has to do something to make clipping happen, thus, it hurts performance.
Kriem
but the clipping itself is not such a thing that the system tells any method that wants to draw outside the bounds: "hey man, don't do. save your time, get a cup of tea. don't have to draw here!"?
Thanks
Actually, it is. Behind the scenes, the OS is doing OpenGl-like stuff where it has to decide what to draw and not. The deciding requires CPU-cycles.
Kriem