Skip navigation.
 
mlkeeping view's bounds fixed
FROM : Nathan Vander Wilt
DATE : Tue Jan 29 05:38:47 2008

Allow me to come at my earlier thread from a different
angle:

I have a view whose bounds I want to keep, so that the
visible area runs from (-180,-90) to (180,90) in the
view's coordinate system. The view needs to autoresize
in all ways, so that its edges are each a fixed
distance away from the window/superview.

In my initWithFrame: method, I call [self
setBounds:NSMakeRect(-180, -90, 360, 180)]; This makes
the intial drawing work as intended, but as soon as
the window (and view) are resized, the bounds get
updated to the match the new frame size.

I tried resetting the bounds at the top of my
drawRect: method, but that doesn't work if only for
the simple reason that the "dirty" rectangle passed
wouldn't get updated. (It also had other nasty side
effects.)

In
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_4_section_6.html,
it says "If the bounds rectangle of the view has not
been explicitly set using one of the setBounds...
methods, the view's bounds rectangle is automatically
updated to match the new frame size."

Since I *have* explicitly set the bounds rectangle,
why is it still being automatically updated to match
the frame's height/width? Where can I reset the
bounds, so that they always are set to
NSMakeRect(-180, -90, 360, 180) when my view's
drawRect is called? The -viewDidEndLiveResize method
will not work, because that message isn't passed when
the window's zoom button is activated.


      ____________________________________________________________________________________
ˇCapacidad ilimitada de almacenamiento en tu correo!
No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:                     
http://correo.espanol.yahoo.com/

Related mailsAuthorDate
mlkeeping view's bounds fixed Nathan Vander Wilt Jan 29, 05:38
mlRe: keeping view's bounds fixed Quincey Morris Jan 29, 06:30
mlRe: keeping view's bounds fixed Nathan Vander Wilt Jan 29, 07:42
mlRe: keeping view's bounds fixed Ken Thomases Jan 30, 05:51