Re: needsDisplay and subviews
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