• 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: Ricky Sharp <email@hidden>
  • Date: Tue, 07 Dec 2004 11:30:20 -0600

On Tuesday, December 07, 2004, at 10:55AM, Michael Becker <email@hidden> wrote:

>Am 07.12.2004 um 03:06 schrieb Michael Becker:
>> Here's something that bothers me: In my application, I have a custom
>> NSBox which holds an NSView. This NSView is again filled with a couple
>> of controls (TableView, Buttons, etc.). The NSView is defined in
>> Interface Builder and programmatically hooked to the NSBox subclass
>> (actually i have several of these NSViews, changing them
>> programmatically).
>
>I tried making the NSViews custom classes, where in their -drawRect:
>method I first set their size to be that of their respective superview.
>This works theoretically, but in practice I have very sloppy drawing.
>In fact, sometimes when I resize the window to be bigger, parts of the
>views won't be drawn. On the next invocation of their drawRect (e.g.
>when I click on them) they draw correctly.

You should never alter the size of things inside drawRect.  The only thing that should occur is drawing.

>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.

--
Rick Sharp
Instant Interactive(tm)

 _______________________________________________
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>)

  • Prev by Date: Re: Found! Click, activate window and select an object
  • Next by Date: toolbar (hilighting currently selected item)
  • 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