FROM : Cathy Shive
DATE : Tue Apr 03 23:04:59 2007
Hello,
I am having some trouble with autoresizing my NSView.
I have a window with a single NSView subclass that I created by
dragging a CustomView from the IB Pallette Window. I want the view,
myCustomView, to keep it's original width and height but to stay
centered in the window when the window is resized. To do this, I can
either set the autoresizing mask in IB by placing springs around each
side or I can set it programmatically with the following code:
[myCustomView setAutoresizingMask: NSViewMinYMargin |
NSViewMaxYMargin |NSViewMinXMargin | NSViewMaxYMargin];
Either way, I get the same behavior. The view stays centered until i
resize the window smaller than the view. Then, when I expand the
window again, the view becomes stuck to one of the window's sides. If
I repeat this action over and over, the view will unstick and stick to
different sides of the window.
I can correct this behavior by overriding the
-(void)resizeWithOldSuperviewSize: method in my custsom view, but I'd
like to understand why it's happening in the first place.
Any thoughts?
Thanks,
Cathy
DATE : Tue Apr 03 23:04:59 2007
Hello,
I am having some trouble with autoresizing my NSView.
I have a window with a single NSView subclass that I created by
dragging a CustomView from the IB Pallette Window. I want the view,
myCustomView, to keep it's original width and height but to stay
centered in the window when the window is resized. To do this, I can
either set the autoresizing mask in IB by placing springs around each
side or I can set it programmatically with the following code:
[myCustomView setAutoresizingMask: NSViewMinYMargin |
NSViewMaxYMargin |NSViewMinXMargin | NSViewMaxYMargin];
Either way, I get the same behavior. The view stays centered until i
resize the window smaller than the view. Then, when I expand the
window again, the view becomes stuck to one of the window's sides. If
I repeat this action over and over, the view will unstick and stick to
different sides of the window.
I can correct this behavior by overriding the
-(void)resizeWithOldSuperviewSize: method in my custsom view, but I'd
like to understand why it's happening in the first place.
Any thoughts?
Thanks,
Cathy
| Related mails | Author | Date |
|---|---|---|
| Cathy Shive | Apr 3, 23:04 | |
| Cathy Shive | Apr 3, 23:10 | |
| Andy Lee | Apr 3, 23:56 |






Cocoa mail archive

