• 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: needsDisplay and subviews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: needsDisplay and subviews


  • Subject: Re: needsDisplay and subviews
  • From: corbin dunn <email@hidden>
  • Date: Thu, 09 Mar 2017 10:32:48 -0800

> On Mar 8, 2017, at 8:46 AM, Jeremy Hughes <email@hidden> wrote:
>
> If needsDisplay is set to true for an NSView, does that also cause subviews to be redrawn?
>
> I’ve seen conflicting statements about this, but haven’t found anything in Apple’s documentation.

Just to be clear: if you want a view to be redrawn you should call setNeedsDisplay on that view. That’s really the bottom line. There are some cases where AppKit will redraw subviews when a parent view is invalidated, but you should not depend on this!

I also don’t recommend things like this:

> override var needsDisplay: Bool
> {
> 	willSet
> 	{
> 		for view in subviews
> 		{
> 			view.needsDisplay = newValue
> 		}
> 	}


Instead, it is better if your subviews invalidate themselves when their state changes.

corbin




_______________________________________________

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: needsDisplay and subviews
      • From: Jeremy Hughes <email@hidden>
References: 
 >needsDisplay and subviews (From: Jeremy Hughes <email@hidden>)

  • Prev by Date: NSOutlineView isn't restoring persistent state for expanded/collapsed
  • Next by Date: Re: NSOutlineView isn't restoring persistent state for expanded/collapsed
  • Previous by thread: Re: needsDisplay and subviews
  • Next by thread: Re: needsDisplay and subviews
  • Index(es):
    • Date
    • Thread