在iOS7下,DZNEmptyDataSet上的重新加载按钮无法点击。
检查后发现原因是在:
- (void)dzn_reloadEmptyDataSet方法中的[self insertSubview:view atIndex:0];
此行代码将提示用户table为空的view放到了table view所有子view的最下面,
而table view还有其它sub views ,最后判断是其中的UITableViewWrapperView,在iOS7中把
空内容提示view的事件阻断了,而iOS8以上则不会。
由这行代码上面的注释看,作者这么作是为了不遮挡可能存在的header、footer、sectionHeader。
如果你的应用场景没有这个问题,则直接用下面的语句替换insertSubview就可以了。
[self addSubview:view];
if (!view.superview) {
// 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];
}
}