Add setVisibilityDepth setter.

This commit is contained in:
Garrett Moon
2016-05-12 10:53:20 -07:00
parent 5a9ef8a6f7
commit 4c78fb3846
4 changed files with 19 additions and 6 deletions

View File

@@ -20,6 +20,8 @@ ASVisibilityViewWillAppear;
ASVisibilityViewDidDisappearImplementation; ASVisibilityViewDidDisappearImplementation;
ASVisibilitySetVisibilityDepth;
ASVisibilityDepthImplementation; ASVisibilityDepthImplementation;
- (void)visibilityDepthDidChange - (void)visibilityDepthDidChange

View File

@@ -20,6 +20,8 @@ ASVisibilityViewWillAppear;
ASVisibilityViewDidDisappearImplementation; ASVisibilityViewDidDisappearImplementation;
ASVisibilitySetVisibilityDepth;
ASVisibilityDepthImplementation; ASVisibilityDepthImplementation;
- (void)visibilityDepthDidChange - (void)visibilityDepthDidChange

View File

@@ -95,11 +95,12 @@ ASVisibilityDidMoveToParentViewController;
[_node recursivelyFetchData]; [_node recursivelyFetchData];
if (_parentManagesVisibilityDepth == NO) { if (_parentManagesVisibilityDepth == NO) {
_visibilityDepth = 0; [self setVisibilityDepth:0];
[self visibilityDepthDidChange];
} }
} }
ASVisibilitySetVisibilityDepth;
ASVisibilityViewDidDisappearImplementation; ASVisibilityViewDidDisappearImplementation;
ASVisibilityDepthImplementation; ASVisibilityDepthImplementation;

View File

@@ -46,6 +46,16 @@ ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth
@end @end
#define ASVisibilitySetVisibilityDepth \
- (void)setVisibilityDepth:(NSUInteger)visibilityDepth \
{ \
if (_visibilityDepth == visibilityDepth) { \
return; \
} \
_visibilityDepth = visibilityDepth; \
[self visibilityDepthDidChange]; \
}
#define ASVisibilityDepthImplementation \ #define ASVisibilityDepthImplementation \
- (NSInteger)visibilityDepth \ - (NSInteger)visibilityDepth \
{ \ { \
@@ -65,8 +75,7 @@ ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth
[super viewDidDisappear:animated]; \ [super viewDidDisappear:animated]; \
\ \
if (_parentManagesVisibilityDepth == NO) { \ if (_parentManagesVisibilityDepth == NO) { \
_visibilityDepth = 1; \ [self setVisibilityDepth:1]; \
[self visibilityDepthDidChange]; \
} \ } \
} }
@@ -76,8 +85,7 @@ ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth
[super viewWillAppear:animated]; \ [super viewWillAppear:animated]; \
\ \
if (_parentManagesVisibilityDepth == NO) { \ if (_parentManagesVisibilityDepth == NO) { \
_visibilityDepth = 0; \ [self setVisibilityDepth:0]; \
[self visibilityDepthDidChange]; \
} \ } \
} }