Skip to content

Commit

Permalink
Consider zPosition when drawing subviews
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoNatan committed Oct 13, 2020
1 parent c1edeae commit 56c609b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion detox/ios/Detox/Utilities/UIView+Drawing.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ - (void)_dtx_drawViewHierarchyUpToSubview:(UIView*)subview rootView:(UIView*)roo
return;
}

for (UIView* obj in self.subviews.reverseObjectEnumerator) {
NSArray* zSorted = [self.subviews.reverseObjectEnumerator.allObjects sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(UIView* _Nonnull obj1, UIView* _Nonnull obj2) {
return [@(obj2.layer.zPosition) compare:@(obj1.layer.zPosition)];
}];

for (UIView* obj in zSorted) {
if([subview isDescendantOfView:obj] == NO)
{
CGContextSaveGState(ctx);
Expand Down

0 comments on commit 56c609b

Please sign in to comment.