iOS如何无嵌入设置空数据显示
1、使用UIScrollView+EmptyDataSet实现列表的空数据展示,将UIScrollView+EmptyDataSet下载之后将整个文件夹拖入到工程里面,文件夹下只有.h与.m两个文件,结构如下:

3、在viewDidLoad下初始化UITableView添加到视图上,同时设置代理:self.tableView.delegate = self;self.tableView.dataSource = self;self.tableView.emptyDataSetSource = self;self.tableView.emptyDataSetDelegate = self;

5、实现DZNEmptyDataSetSource下的- (nullable NSAttributedString *)tit造婷用痃leForEmptyDataSet:(UIScrollView *)scrollView代理方法可以设置空数据显示时的提示文字:- (nullable NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView{ return [[NSAttributedString alloc] initWithString:@"暂无数据" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]}];}

7、实现DZNEmptyDataSetSource下的- (nullable UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView代理方法可以设置空数据显示时的界面背景颜色:- (nullable UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView{ return [UIColor colorWithRed:237/255.0 green:237/255.0 blue:237/255.0 alpha:1.0];}

9、将列表的行数设置为0,空数据界面显示效果如下:
