• 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
Re: NSView not resizing when parent view resizes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView not resizing when parent view resizes


  • Subject: Re: NSView not resizing when parent view resizes
  • From: "John C. Randolph" <email@hidden>
  • Date: Wed, 8 Dec 2004 10:02:35 -0800

Michael,

I wouldn't expect NSView to send [self autoresizingMask] in its -setFrame: method, since it can just check the ivar to see how to resize. So, your override of -autoresizingMask has no effect.

I would just send it a "setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)" message.

-jcr


On Dec 8, 2004, at 2:24 AM, Michael Becker wrote:

Am 07.12.2004 um 18:30 schrieb Ricky Sharp:

What is happening? How can I make them resize smoothly according to
their superviews?

I know you mentioned that you've called setAutoresizesSubviews:. Have you also called setAutoresizingMask: to set up the appropriate options? Ultimately, all your subviews should be receiving resizeWithOldSuperviewSize: messages. NSView's default implementation of resizeWithOldSuperviewSize: is to use the options set up with setAutoresizingMask:. You can also override resizeWithOldSuperviewSize if you need something custom.

Hm, doesn't work either. Here is a part of my NSView subclass code:

- (unsigned int)autoresizingMask {
 NSLog(@"autoresizingMask");
 return (NSViewWidthSizable | NSViewHeightSizable);
}

- (BOOL)autoresizesSubviews {
 NSLog(@"autoresizesSubviews");
 return YES;
}

- (void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize {
 NSLog(@"resizeWithOldSuperviewSize");
 [ super resizeWithOldSuperviewSize:oldBoundsSize];
}

Although all the views are set up in IB to be of this custom class, nothing is ever getting logged. I rephrase: These custom views are set up as a subview of another custom view object (which overrides basically only the drawRect: method to make it look fancier). If I resize the window, the "superview" view resizes nicely but these embedded views do not. In IB I have all the sizing options set up correctly, AFAICS.

Cheers,
Michael
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSView not resizing when parent view resizes
      • From: Michael Becker <email@hidden>
References: 
 >NSView not resizing when parent view resizes (From: Michael Becker <email@hidden>)
 >Re: NSView not resizing when parent view resizes (From: Michael Becker <email@hidden>)
 >Re: NSView not resizing when parent view resizes (From: Ricky Sharp <email@hidden>)
 >Re: NSView not resizing when parent view resizes (From: Michael Becker <email@hidden>)

  • Prev by Date: Re: Confused about bindings and NSTableView
  • Next by Date: Re: Confused about bindings and NSTableView
  • Previous by thread: Re: NSView not resizing when parent view resizes
  • Next by thread: Re: NSView not resizing when parent view resizes
  • Index(es):
    • Date
    • Thread