To run the example project, clone the repo, and run pod install
from the Example directory first.
XTEmptyDataSet is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'XTEmptyDataSet'
Configure global Settings:
[UIView xt_setupGlobalEmptySetData:^(XTEmptyDataSetType type, XTDataSetConfig * _Nonnull config) {
if (type == XTEmptyDataSetTypeLoading) {
config.emptyStyle = XTDataSetStyleIndicator;
}else if (type == XTEmptyDataSetTypeError) {
config.emptyStyle = XTDataSetStyleTextAction;
config.lableText = @"网络出错";
config.buttonCornerRadius = 4;
config.buttonBorderColor = [UIColor blueColor];
config.buttonBorderWidth = 1;
config.buttonNormalTitleColor = [UIColor blueColor];
config.buttonTouchHandler = ^{
NSLog(@"重试");
};
}else if (type == XTEmptyDataSetTypeNoData) {
config.emptyStyle = XTDataSetStyleTextAction;
config.lableText = @"暂无数据";
}
}];
Use on view:
[self xt_display:XTEmptyDataSetTypeLoading];
Use on tableView or colllectionView:
[self.tableView xt_reloadDataIfEmptyDisplay:XTEmptyDataSetTypeNoData];
zt.cheng, [email protected]
XTEmptyDataSet is available under the MIT license. See the LICENSE file for more info.