> On Mar 8, 2017, at 8:46 AM, Jeremy Hughes <[email protected]> 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 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]