• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Views, frames, and bounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Views, frames, and bounds (From: DKJ <email@hidden>)

  • Prev by Date: Re: What is "A class which must be subclassed" ?
  • Next by Date: Re: Views, frames, and bounds
  • Previous by thread: Re: Views, frames, and bounds
  • Next by thread: Re: Views, frames, and bounds
  • Index(es):
    • Date
    • Thread