浏览代码

adjust DZNEmpty <h>

Marino Faggiana 8 年之前
父节点
当前提交
a15d245393

+ 0 - 5
iOSClient/Favorites/CCFavorites.m

@@ -140,11 +140,6 @@
     return 0.0f;
 }
 
-- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
-{
-    return - self.navigationController.navigationBar.frame.size.height;
-}
-
 - (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
 {
     return [UIColor whiteColor];

+ 0 - 5
iOSClient/Local storage/CCLocalStorage.m

@@ -115,11 +115,6 @@
     return 0.0f;
 }
 
-- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
-{
-    return - self.navigationController.navigationBar.frame.size.height;
-}
-
 - (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
 {
     return [UIColor whiteColor];

+ 0 - 12
iOSClient/PhotosCameraUpload/CCPhotosCameraUpload.m

@@ -259,23 +259,11 @@
     return YES;
 }
 
-/*
-- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView
-{    
-    return YES;
-}
-*/
-
 - (CGFloat)spaceHeightForEmptyDataSet:(UIScrollView *)scrollView
 {
     return 0.0f;
 }
 
-- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
-{
-    return - self.navigationController.navigationBar.frame.size.height;
-}
-
 - (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
 {
     return [UIColor whiteColor];

+ 2 - 1
iOSClient/Transfers/CCTransfers.h

@@ -22,8 +22,9 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "UIScrollView+EmptyDataSet.h"
 
-@interface CCTransfers : UIViewController <UITableViewDataSource, UITableViewDelegate>
+@interface CCTransfers : UIViewController <UITableViewDataSource, UITableViewDelegate, DZNEmptyDataSetDelegate , DZNEmptyDataSetSource>
 
 @property (nonatomic, weak) IBOutlet UITableView *tableView;
 

+ 39 - 0
iOSClient/Transfers/CCTransfers.m

@@ -68,6 +68,9 @@
     
     _tableView.delegate = self;
     _tableView.dataSource = self;
+    _tableView.emptyDataSetDelegate = self;
+    _tableView.emptyDataSetSource = self;
+    
     _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
     _tableView.backgroundColor = [UIColor clearColor];
     
@@ -102,6 +105,42 @@
     [super didReceiveMemoryWarning];
 }
 
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ==== DZNEmptyDataSetSource ====
+#pragma --------------------------------------------------------------------------------------------
+
+- (CGFloat)spaceHeightForEmptyDataSet:(UIScrollView *)scrollView
+{
+    return 0.0f;
+}
+
+- (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
+{
+    return [UIColor whiteColor];
+}
+
+- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
+{
+    NSString *text = [NSString stringWithFormat:@"%@", @""];
+    
+    NSDictionary *attributes = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:20.0f], NSForegroundColorAttributeName:COLOR_BRAND};
+    
+    return [[NSAttributedString alloc] initWithString:text attributes:attributes];
+}
+
+- (NSAttributedString *)descriptionForEmptyDataSet:(UIScrollView *)scrollView
+{
+    NSString *text = [NSString stringWithFormat:@"\n%@", NSLocalizedString(@"_no_transfer_", nil)];
+    
+    NSMutableParagraphStyle *paragraph = [NSMutableParagraphStyle new];
+    paragraph.lineBreakMode = NSLineBreakByWordWrapping;
+    paragraph.alignment = NSTextAlignmentCenter;
+    
+    NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0], NSForegroundColorAttributeName: [UIColor lightGrayColor], NSParagraphStyleAttributeName: paragraph};
+    
+    return [[NSAttributedString alloc] initWithString:text attributes:attributes];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark - ===== Progress & Task Button =====
 #pragma --------------------------------------------------------------------------------------------