• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Subviews of a borderless window - autoresizing mask does not work for me
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subviews of a borderless window - autoresizing mask does not work for me


  • Subject: Subviews of a borderless window - autoresizing mask does not work for me
  • From: Hendrik Holtmann <email@hidden>
  • Date: Wed, 2 Apr 2008 16:35:09 +0200

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


  • Follow-Ups:
    • Re: Subviews of a borderless window - autoresizing mask does not work for me
      • From: Cathy Shive <email@hidden>
    • Re: Subviews of a borderless window - autoresizing mask does not work for me
      • From: Nate Weaver <email@hidden>
  • Prev by Date: Re: How to store NSRect as Core Data attribute?
  • Next by Date: Re: Problem with Grouping the rotated object.
  • Previous by thread: Re: prefPane with background process
  • Next by thread: Re: Subviews of a borderless window - autoresizing mask does not work for me
  • Index(es):
    • Date
    • Thread