https://github.com/dzenbot/DZNEmptyDataSet
5000+ star
最简单使用
// tableView 本身方法全部正常使用就好了。不影响、
self.tableView.emptyDataSetSource = self;
// 结合代理,展示图片,注意大小
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
return [UIImage imageNamed:@"iconfont-home-2"];
}
更多数据源
// 提示 标题 title
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView;
// 提示内容 message
- (NSAttributedString *)descriptionForEmptyDataSet:(UIScrollView *)scrollView;
// 图片 注意大小
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView;
// 图片 tintColor
- (UIColor *)imageTintColorForEmptyDataSet:(UIScrollView *)scrollView;
// 添加 提示图片的 动画
- (CAAnimation *) imageAnimationForEmptyDataSet:(UIScrollView *) scrollView;
// 按钮文字
- (NSAttributedString *)buttonTitleForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state;
// 按钮图片
- (UIImage *)buttonImageForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state;
- (UIImage *)buttonBackgroundImageForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state;
// 大背景颜色
- (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView;
// 自定义view
- (UIView *)customViewForEmptyDataSet:(UIScrollView *)scrollView;
// 内容偏移
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView;
// 内容间距
- (CGFloat)spaceHeightForEmptyDataSet:(UIScrollView *)scrollView;
更多代理
// 亲测 无效?
- (BOOL)emptyDataSetShouldFadeIn:(UIScrollView *)scrollView;
// 作为背景,YES:一直显示;NO:没数据才显示
- (BOOL)emptyDataSetShouldBeForcedToDisplay:(UIScrollView *)scrollView;
// 是否使用 背景
- (BOOL)emptyDataSetShouldDisplay:(UIScrollView *)scrollView;
// 触摸激活
- (BOOL)emptyDataSetShouldAllowTouch:(UIScrollView *)scrollView;
// 滚动激活
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView;
// 动画激活
- (BOOL)emptyDataSetShouldAnimateImageView:(UIScrollView *)scrollView;
// 点击 view
- (void)emptyDataSet:(UIScrollView *)scrollView didTapView:(UIView *)view;
// 点击 btn
- (void)emptyDataSet:(UIScrollView *)scrollView didTapButton:(UIButton *)button;
- (void)emptyDataSetWillAppear:(UIScrollView *)scrollView;
- (void)emptyDataSetDidAppear:(UIScrollView *)scrollView;
- (void)emptyDataSetWillDisappear:(UIScrollView *)scrollView;
- (void)emptyDataSetDidDisappear:(UIScrollView *)scrollView;
1
网友评论