Skip to content
This repository was archived by the owner on Nov 29, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Source/UIScrollView+EmptyDataSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ - (void)prepareForReuse;

@end

@interface UITableView (DZNiOS7TableViewWrapperView)

- (UIView *)dzn_tableViewWrapperView;

@end

@implementation UITableView (DZNiOS7TableViewWrapperView)

- (UIView *)dzn_tableViewWrapperView {
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1 &&
floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1 &&
[self isKindOfClass:[UITableView class]]) {
for (UIView *subview in [self subviews]) {
if ([subview isKindOfClass:NSClassFromString(@"UITableViewWrapperView")]) {
return subview;
}
}
}

return nil;
}

@end


#pragma mark - UIScrollView+EmptyDataSet

Expand Down Expand Up @@ -287,6 +311,10 @@ - (void)dzn_willAppear

- (void)dzn_didAppear
{
if ([self isKindOfClass:[UITableView class]]) {
[(UITableView *)self dzn_tableViewWrapperView].userInteractionEnabled = NO;
}

if (self.emptyDataSetDelegate && [self.emptyDataSetDelegate respondsToSelector:@selector(emptyDataSetDidAppear:)]) {
[self.emptyDataSetDelegate emptyDataSetDidAppear:self];
}
Expand All @@ -301,6 +329,10 @@ - (void)dzn_willDisappear

- (void)dzn_didDisappear
{
if ([self isKindOfClass:[UITableView class]]) {
[(UITableView *)self dzn_tableViewWrapperView].userInteractionEnabled = YES;
}

if (self.emptyDataSetDelegate && [self.emptyDataSetDelegate respondsToSelector:@selector(emptyDataSetDidDisappear:)]) {
[self.emptyDataSetDelegate emptyDataSetDidDisappear:self];
}
Expand Down