Skip to content

一行代码可以集成UITableView 和 UICollectionView 在数据源没有数据的时候展示一个默认占位图片。

License

Notifications You must be signed in to change notification settings

CepheusSun/EmptyDataKit

Repository files navigation

EmptyDataKit 中文

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

EmptyDataKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "EmptyDataKit"

ScreenShot

this kit is also added to the other repository named SBAnimation and the demo in SBAnimation is cleaner more clearly. so sorry that I don't want to replace this demo with SBAnimation . so I show you the screenshot in that demo here too. you can go there to read my codes if you need to.

Usage

Add the codes when you need to use EmptyDataKit, Such as ViewDidLoad

		__weak typeof(self) weakSelf = self;
        EmptyDataKit *kit = [[EmptyDataKit alloc] initWithEdk_Image:[UIImage imageNamed:@"common_pic_loadFail"] edk_Message:@"aaa" edk_reloadHandler:^{
            [weakSelf getData];
        }];
        kit.edk_error_image = [UIImage imageNamed: @""];
        kit.edk_error_message = @"网络错误";
        self.tableView.emptyKit = kit;

and we also provide you a enum like this

typedef NS_ENUM(NSUInteger ,EmptyDataType) {
    EDK_Loading,     // if there is a LoadingView, use this ,and also this is a default status.
    EDK_None,        // if there is some data, use this.
    EDK_Empty,       // if there is no data, use this.
    EDK_Error        // if there is some error such as network, use this.
};

so that if you want to show different image or description words you can use this. before you use reloadData method of this tebleView or collectionView.

Author

CepheusSun, cd_sunyang@163.com

License

EmptyDataKit is available under the MIT license. See the LICENSE file for more info.

About

一行代码可以集成UITableView 和 UICollectionView 在数据源没有数据的时候展示一个默认占位图片。

Resources

License

Stars

Watchers

Forks

Packages

No packages published