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: Erik Buck <email@hidden>
- Date: Sun, 25 May 2008 22:04:34 -0400
Changing the opengl viewport every time you draw is generally a poor
practice. Setting the viewport is traditionally one of the most
expensive open gl operations. The window will not resize anywhere
near as often as the view will be redrawn. That is why it is usually
better to reset the viewport only when the view actually has resized.
Views can be configured in Interface Builder or via code to resize
automatically as the window changes size. The framework calls the
view's setFrame: method as needed. The bounds are automatically
recalculated when the frame changes, but that is not always what you
want. I often want my bounds coordinates to stay the same even if the
view changes size so that if the view is enlarges, the content is
scaled to fill the new size.
None of this is magic or complex. Just read about the view hierarchy
in the documentation. http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Introduction/chapter_1_section_1.html
_______________________________________________
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