Browse Source

1.修改iOS UIScrollView EmptyView,增加背景色设置以及Title自定义。

Pen Li 7 năm trước cách đây
mục cha
commit
4dfc0d3f38

+ 2 - 0
common/EmptyView/RAEmptyView.h

@@ -12,4 +12,6 @@
 
 + (instancetype)emptyViewWithTapBlk:(void(^)(id sender))tapEmptyBlk;
 
++ (instancetype)emptyViewWithTitle:(NSString *)title clickHandler:(void(^)(id sender))handler;
+
 @end

+ 14 - 0
common/EmptyView/RAEmptyView.m

@@ -25,6 +25,20 @@
     return emptyView;
 }
 
++ (instancetype)emptyViewWithTitle:(NSString *)title clickHandler:(void(^)(id sender))handler {
+    
+    RAEmptyView *emptyView = [RAEmptyView new];
+    emptyView.tapEmptyBlk = handler;
+    
+    emptyView.tipLabel.text = title;
+    
+    [emptyView.tipLabel sizeToFit];
+    CGSize size = emptyView.bounds.size;
+    emptyView.frame = CGRectMake(0, 0, size.width + 10, size.height + 10);
+    
+    return emptyView;
+}
+
 - (instancetype)init {
     
     if (self = [super init]) {

+ 2 - 0
common/UIScrollVIew+Empty/UIScrollView+Empty.h

@@ -16,4 +16,6 @@
 
 - (void)hideEmpty;
 
+- (void)setEmptyContentViewBackgroupColor:(UIColor *)color;
+
 @end

+ 4 - 0
common/UIScrollVIew+Empty/UIScrollView+Empty.m

@@ -74,4 +74,8 @@ static const float duration = 0.25;
     [self sendSubviewToBack:view];
 }
 
+- (void)setEmptyContentViewBackgroupColor:(UIColor *)color {
+    self.emptyContentView.backgroundColor = color;
+}
+
 @end