Re: Views, frames, and bounds
Re: Views, frames, and bounds
- Subject: Re: Views, frames, and bounds
- From: "Michael Ash" <email@hidden>
- Date: Sun, 19 Oct 2008 10:21:57 -0400
On Sat, Oct 18, 2008 at 11:04 PM, DKJ <email@hidden> wrote:
> I am unable to understand the relation between the frame and the bounds of
> an NSView. I've read the documentation in the View Programming Guide, and
> also played around with them myself in a practice project. In the latter, I
> tried drawing their rectangles in different colours, but couldn't get both
> to display. So I'm still at a loss. Can someone point me towards other
> documentation that might get through the fog?
Take a piece of graph paper. Draw a dot on the paper at coordinate
1,1. Now draw a rectangle from 5,5 to 15, 15. Call this rectangle
"view". Now draw a dot inside "view" at 1,1. Notice how it's not at
the same location as the original dot.
View's frame is 5,5, 10,10. (Cocoa rectangles are origin/size, not
point/point.) View's bounds are the same, but expressed in the same
coordinates that put the second dot inside the view. Its bounds are
0,0, 10,10.
If you move view around the page, its frame changes but its bounds do not.
Does that make it more clear?
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden