> On 9 Mar 2017, at 10:24, Jeremy Hughes <[email protected]> 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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to