• 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: Jeremy Hughes <email@hidden>
  • Date: Thu, 09 Mar 2017 10:35:23 +0000

> On 9 Mar 2017, at 10:24, Jeremy Hughes <email@hidden> wrote:
>
> So it seems that for layer-backed views, setting needsDisplay does cause the view to be redrawn - but the value is never actually set. If I needed to work with layer-backed views, it might be possible to get around this by overriding willSet instead of didSet.

I’ve now tried this, and it works.

To ensure that a subview will be redrawn when needsDisplay is (attempted to be) set on its superview we can add the following code:

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

Jeremy


_______________________________________________

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


References: 
 >needsDisplay and subviews (From: Jeremy Hughes <email@hidden>)
 >Re: needsDisplay and subviews (From: Ben Kennedy <email@hidden>)
 >Re: needsDisplay and subviews (From: Jeremy Hughes <email@hidden>)
 >Re: needsDisplay and subviews (From: Quincey Morris <email@hidden>)
 >Re: needsDisplay and subviews (From: Jeremy Hughes <email@hidden>)

  • Prev by Date: Re: needsDisplay and subviews
  • Next by Date: Re: How do I use a NSTextBlock in an attributed string?
  • Previous by thread: Re: needsDisplay and subviews
  • Next by thread: Re: needsDisplay and subviews
  • Index(es):
    • Date
    • Thread