diff --git a/TBEmptyDataSet.podspec b/TBEmptyDataSet.podspec index b94d101..68bed63 100644 --- a/TBEmptyDataSet.podspec +++ b/TBEmptyDataSet.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "TBEmptyDataSet" - s.version = "1.3" + s.version = "1.4" s.summary = "An extension of UITableView/UICollectionView's super class, it will display a placeholder when the data is empty." s.homepage = "https://github.com/teambition/TBEmptyDataSet" diff --git a/TBEmptyDataSet/TBEmptyDataSet.swift b/TBEmptyDataSet/TBEmptyDataSet.swift index 13ac8ad..352665c 100644 --- a/TBEmptyDataSet/TBEmptyDataSet.swift +++ b/TBEmptyDataSet/TBEmptyDataSet.swift @@ -243,8 +243,11 @@ extension UIScrollView: UIGestureRecognizerDelegate { emptyDataSetWillAppear() if emptyDataView.superview == nil { - addSubview(emptyDataView) - bringSubviewToFront(emptyDataView) + if (self is UITableView || self is UICollectionView) && subviews.count > 1 { + insertSubview(emptyDataView, atIndex: 0) + } else { + addSubview(emptyDataView) + } } emptyDataView.resetEmptyDataView()