Thanks
Thanks

Reputation: 40349

Does it make sense that the bounds rectangle of an UIView can be bigger than the frame rectangle?

As I understand, the bounds rectangle actually is always the same size as the frame rectangle, and has the origin (0, 0) relative to the frame rectangle coordinate system.

If for some reason the bounds rectangle appears to be smaller than the frame rectangle, the content will be clipped while the frame rectangle uses larger space than needed.

But what would happen, if the bounds rectangle is bigger than the frame rectangle?

Is it valid to think about frame rectangle and bounds rectangle in the way of an html div container that's absolute positioned and has an padding, and overflow:hidden in css style?

I don't see any reason why it would make sense to have a bigger bound rectangle. Another problem raises up from the positioning of the bound relative to the frame rectangle coordinate system. So even if both have the same size: If the bounds rectangle is not positioned in the origin at (0, 0), do we have a big problem here? What happens?

Upvotes: 1

Views: 2292

Answers (1)

amattn
amattn

Reputation: 10065

I just answered this in your other post:

Why is there an frame rectangle and an bounds rectangle in an UIView?

Basically, you are allowed to draw outside the frame if the bounds is set big enough. Imagine you are drawing a window. You need the frame to be the exact window dimensions for taps, clicks and UI purposes. However, you need to draw a shadow. If your bounds is bigger than the frame, you can draw the shadow (or any other outer border) outside of the frame.

Upvotes: 3

Related Questions