Re: Subviews of a borderless window - autoresizing mask does not work for me
Re: Subviews of a borderless window - autoresizing mask does not work for me
- Subject: Re: Subviews of a borderless window - autoresizing mask does not work for me
- From: Nate Weaver <email@hidden>
- Date: Wed, 2 Apr 2008 10:36:29 -0500
You probably want to use NSViewMaxYMargin instead of NSViewMinYMargin
(NSViewMinYMargin is the bottom margin of the content view and not the
top).
On Apr 2, 2008, at 9:35 AM, Hendrik Holtmann wrote:
Hi,
I am creating a borderless window in source like this:
containerWindow = [[[ContainerWindow alloc]
initWithContentRect:NSMakeRect
(rect.origin.x,rect.origin.y-22-34,387,34)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered
defer:NO] retain];
Then I add a custom view (created in interface builder) as a subview
using the following code:
NSRect frame = [mySearchView bounds];
[mySearchView
setFrame:NSMakeRect(0.0,0,frame.size.width,frame.size.height)];
[[containerWindow contentView] addSubview:mySearchView positioned:1
relativeTo:nil];
[mySearchView setNeedsDisplay:YES];
That works fine. I want the customs subview position to be fixed
now, so when resizing occurs it does not change its position and
stays fixed to the upper left corner of the window.
Therefore I used
[[containerWindow contentView] setAutoresizesSubviews:YES];
[mySearchView setAutoresizingMask:NSViewMinYMargin];
According to the documentation this should be the right way to do it
(hopefully). Then I change the height of containerWindow in source
using:
NSRect frame = [containerWindow frame];
frame.size.height += 200;
frame.origin.y -= 200;
[containerWindow setFrame: frame display: YES animate: NO];
What happens now is that mySearchView moves to the buttom of the
window. What I would like to achieve is that its fixed to the top of
the window (left corner). Obviously the autoresizing mask does not
work here?
Did I miss something? any help would be appreciated!
Best,
Hendrik
_______________________________________________
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