keeping view's bounds fixed
keeping view's bounds fixed
- Subject: keeping view's bounds fixed
- From: Nathan Vander Wilt <email@hidden>
- Date: Mon, 28 Jan 2008 22:38:47 -0600 (CST)
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/
_______________________________________________
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