Re: Resizing a view to match the main NSWindow size?
Re: Resizing a view to match the main NSWindow size?
- Subject: Re: Resizing a view to match the main NSWindow size?
- From: Keary Suska <email@hidden>
- Date: Mon, 26 May 2008 11:07:22 -0600
- Thread-topic: Resizing a view to match the main NSWindow size?
on 5/25/08 7:51 PM, email@hidden purportedly said:
> I think I am close but don't understand how the coordinate system of
> an NSView relates to the NSWindow it resides in.
>
> It looks like the NSView setFrame method will help but I am getting
> weird results. Am I on the right track?
Perhaps. The "frame" of a view should always be the coordinates of the view
in it's parent, using the parent's coordinate system. But also, every window
has a contentView by default. So if you place an NSView inside a window in
IB, for instance, it is actually a child of the contentView, which in turn
is a child of the NSWindow. So, when you get the frame of your view, it is
in the contentView's coordinate system.
Now, OTOH, since the contentView is sized to the whole viewable content of
the window, you should be able to pass the contentView's frame to -setFrame
of your view. Note that this is not because they are the same, but simply
that they will probably be equivalent relative to their own coordinate
systems.
Have you read this:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/
Transforms/chapter_4_section_1.html#//apple_ref/doc/uid/TP40003290-CH204-BCI
DJJBI
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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