Skip to content

Commit

Permalink
Add fix from dzenbot#182
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhumber committed Apr 27, 2016
1 parent fc2bc59 commit ac865a0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Source/UIScrollView+EmptyDataSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,15 @@ - (void)dzn_reloadEmptyDataSet
DZNEmptyDataSetView *view = self.emptyDataSetView;

if (!view.superview) {
[self addSubview:view];

// Send the view all the way to the back, in case a header and/or footer is present, as well as for sectionHeaders or any other content
if (([self isKindOfClass:[UITableView class]] || [self isKindOfClass:[UICollectionView class]]) && self.subviews.count > 1) {
[self insertSubview:view atIndex:0];
}
else {
[self addSubview:view];
}
[self sendSubviewToBack:view];

// make sure the y origin of view is 0. adding it to a scrollView may have changed it
CGRect frame = view.frame;
frame.origin.y = 0;
view.frame = frame;
}

// Removing view resetting the view and its constraints it very important to guarantee a good state
Expand Down

0 comments on commit ac865a0

Please sign in to comment.