Thanks @scottg, this is a better more generalized solution.

This commit is contained in:
Garrett Moon
2016-03-01 16:46:03 -08:00
parent eba6afc36b
commit 057c431dfb

View File

@@ -2083,8 +2083,14 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
[self setDisplaySuspended:NO]; [self setDisplaySuspended:NO];
} else { } else {
[self setDisplaySuspended:YES]; [self setDisplaySuspended:YES];
//schedule clear contents on next runloop
dispatch_async(dispatch_get_main_queue(), ^{
ASDN::MutexLocker l(_propertyLock);
if (ASInterfaceStateIncludesDisplay(_interfaceState) == NO) {
[self clearContents]; [self clearContents];
} }
});
}
} else { } else {
// NOTE: This case isn't currently supported as setInterfaceState: isn't exposed externally, and all // NOTE: This case isn't currently supported as setInterfaceState: isn't exposed externally, and all
// internal use cases are range-managed. When a node is visible, don't mess with display - CA will start it. // internal use cases are range-managed. When a node is visible, don't mess with display - CA will start it.
@@ -2095,8 +2101,14 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
[ASDisplayNode scheduleNodeForRecursiveDisplay:self]; [ASDisplayNode scheduleNodeForRecursiveDisplay:self];
} else { } else {
[[self asyncLayer] cancelAsyncDisplay]; [[self asyncLayer] cancelAsyncDisplay];
//schedule clear contents on next runloop
dispatch_async(dispatch_get_main_queue(), ^{
ASDN::MutexLocker l(_propertyLock);
if (ASInterfaceStateIncludesDisplay(_interfaceState) == NO) {
[self clearContents]; [self clearContents];
} }
});
}
} }
} }
} }