iOS DZNEmptyDataSet 设置图片位置
1.导入头文件#import "UIScrollView+EmptyDataSet.h"
2.代理协议DZNEmptyDataSetSource, DZNEmptyDataSetDelegate;
_tableView.emptyDataSetSource = self;
_tableView.emptyDataSetDelegate = self;
3.实现代理方法
#pragma mark - DZNEmptyDataSetSource
// 返回图片
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView{
return [UIImage imageNamed:@"bg_img_middle_chahua_3"];
}
// 返回标题文字
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
NSString *text = @"您当前暂无审核记录";
NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFontOfSize:SYRealValue(17)], NSForegroundColorAttributeName: [UIColor lightGrayColor]};
return [[NSAttributedString alloc] initWithString:text attributes:attribute];
}
// 调整图片位置
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
return -50;
}