Browse Source

1.相册无数据显示

huangxiaodong 1 year ago
parent
commit
c698c57929

+ 28 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.m

@@ -19,7 +19,7 @@
 #import "fileTransferPathCheckViewController.h"
 #import "ComontAlretViewController.h"
 
-@interface uploadImageOrVideoViewController ()<AJPhotoGroupViewProtocol,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
+@interface uploadImageOrVideoViewController ()<AJPhotoGroupViewProtocol,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 {
     couldPhoneBaseInfoModel *baseInfoModel;
 }
@@ -259,6 +259,10 @@
     [self.view insertSubview:collectionView atIndex:0];
     self.photoListView = collectionView;
     
+    //空数据引入第三方开源处理
+    collectionView.emptyDataSetSource = self;
+    collectionView.emptyDataSetDelegate = self;
+    
     [collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
@@ -476,6 +480,29 @@
     };
 }
 
+#pragma mark 空数据
+- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
+    
+    NSString *imageName = @"common_no_data_pic";
+    
+    return [UIImage imageNamed:imageName];
+}
+
+- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
+    NSString *text = NSLocalizedString(@"common_no_data_tip",nil);
+    
+    NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
+                                 NSForegroundColorAttributeName: HW999999Color};
+    
+    return [[NSAttributedString alloc] initWithString:text attributes:attributes];
+}
+
+//调整图片位置
+- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
+    return -50;
+}
+
+
 #pragma mark 从详情页回来 刷新数据和UI
 - (void)refreshDataAndUIFunWith:(NSMutableArray *)indexPathsForSelectedItems
 {