updated load and display did change methods

This commit is contained in:
Luke Parham
2016-05-04 16:38:10 -05:00
parent 8526171b30
commit d47059dffe
3 changed files with 39 additions and 61 deletions

View File

@@ -243,32 +243,22 @@ NS_ASSUME_NONNULL_BEGIN
- (void)visibilityDidChange:(BOOL)isVisible ASDISPLAYNODE_REQUIRES_SUPER;
/**
* @abstract Called whenever the the node enters the display range.
* @abstract Called whenever the the node has entered or left the display state.
*
* @discussion Subclasses may use this to monitor when they enter the display range.
* @discussion Subclasses may use this to monitor when a node should be rendering its content.
*
* @note This method can be called from any thread and should therefore be thread safe.
*/
- (void)didEnterDisplayRange ASDISPLAYNODE_REQUIRES_SUPER;
- (void)displayStateDidChange:(BOOL)inDisplayState ASDISPLAYNODE_REQUIRES_SUPER;
/**
* @abstract Called whenever the the node exits the display range.
* @abstract Called whenever the the node has entered or left the load state.
*
* @discussion Subclasses may use this to monitor when they exit the display range.
*/
- (void)didExitDisplayRange ASDISPLAYNODE_REQUIRES_SUPER;
/**
* @abstract Called whenever the the node enters the fetch data range.
* @discussion Subclasses may use this to monitor data for a node should be loaded, either from a local or remote source.
*
* @discussion Subclasses may use this to monitor when they enter the fetch data range.
* @note This method can be called from any thread and should therefore be thread safe.
*/
- (void)didEnterFetchDataRange ASDISPLAYNODE_REQUIRES_SUPER;
/**
* @abstract Called whenever the the node exits the fetch data range.
*
* @discussion Subclasses may use this to monitor when they exit the fetch data range.
*/
- (void)didExitFetchDataRange ASDISPLAYNODE_REQUIRES_SUPER;
- (void)loadStateDidChange:(BOOL)inLoadState ASDISPLAYNODE_REQUIRES_SUPER;
/**
* Called just before the view is added to a window.

View File

@@ -2178,22 +2178,12 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
// subclass override
}
- (void)didEnterDisplayRange
- (void)displayStateDidChange:(BOOL)inDisplayState
{
//subclass override
}
- (void)didExitDisplayRange
{
//subclass override
}
- (void)didEnterFetchDataRange
{
//subclass override
}
- (void)didExitFetchDataRange
- (void)loadStateDidChange:(BOOL)inLoadState
{
//subclass override
}
@@ -2242,12 +2232,12 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
if (nowFetchData != wasFetchData) {
if (nowFetchData) {
[self fetchData];
[self didEnterFetchDataRange];
[self loadStateDidChange:YES];
} else {
if ([self supportsRangeManagedInterfaceState]) {
[self clearFetchedData];
}
[self didExitFetchDataRange];
[self loadStateDidChange:NO];
}
}
@@ -2293,9 +2283,9 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
}
if (nowDisplay) {
[self didEnterDisplayRange];
[self displayStateDidChange:YES];
} else {
[self didExitDisplayRange];
[self displayStateDidChange:NO];
}
}