Re: NSView autoresizing
Re: NSView autoresizing
- Subject: Re: NSView autoresizing
- From: "Cathy Shive" <email@hidden>
- Date: Tue, 3 Apr 2007 17:10:39 -0400
i see that I have a typo in the code i provided. this is the code I
use to set my autoresizing mask:
[myCustomView setAutoresizingMask:NSViewMaxYMargin | NSViewMinYMargin
NSViewMinXMargin | NSViewMaxXMargin];
thanks!
cathy
On 4/3/07, Cathy Shive <email@hidden> wrote:
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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