#import "UIScrollView+EmptyDataSet.h"
遵守代理和数据源方法()<DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"贷款订单";
self.view.backgroundColor = mainWhiteColor;
[self creatLoanOrderListView];
}
- (void)creatLoanOrderListView{
_orderDataArr = [[NSMutableArray alloc] init];
self.orderTableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, mainScreenW, mainScreenH - STATUS_AND_NAVIGATION_HEIGHT) style:UITableViewStylePlain];
self.orderTableview.delegate = self;
self.orderTableview.dataSource = self;
self.orderTableview.emptyDataSetSource = self;
self.orderTableview.emptyDataSetDelegate = self;
self.orderTableview.tableFooterView = [UIView new];
self.orderTableview.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:self.orderTableview];
self.orderTableview.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
self.orderTableview.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefershDta)];
}
/**************DZNEmptyDataSetSource***********/
/**
* 返回空的图片
*/
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
{
return [UIImage imageNamed:@"empty_placeholder"];
}
/**
* 标题文字
*/
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
{
NSString *text = @"Please Allow Photo Access";
NSDictionary *attributes = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:18.0f],
NSForegroundColorAttributeName: [UIColor darkGrayColor]};
return [[NSAttributedString alloc] initWithString:text attributes:attributes];
}
/**
* 详情文字
*/
- (NSAttributedString *)descriptionForEmptyDataSet:(UIScrollView *)scrollView
{
NSString *text = @"This allows you to share photos from your library and save photos to your camera roll.";
NSMutableParagraphStyle *paragraph = [NSMutableParagraphStyle new];
paragraph.lineBreakMode = NSLineBreakByWordWrapping;
paragraph.alignment = NSTextAlignmentCenter;
NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0f],
NSForegroundColorAttributeName: [UIColor lightGrayColor],
NSParagraphStyleAttributeName: paragraph};
return [[NSAttributedString alloc] initWithString:text attributes:attributes];
}
/**
* 文字按钮
*/
- (NSAttributedString *)buttonTitleForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state
{
NSDictionary *attributes = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:17.0f]};
return [[NSAttributedString alloc] initWithString:@"Continue" attributes:attributes];
}
/**
* 返回图片按钮
*/
- (UIImage *)buttonImageForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state
{
return [UIImage imageNamed:@"button_image"];
}
/**
* 自定义背景颜色
*/
- (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
{
return [UIColor whiteColor];
}
/**
* 返回一个自定义的View
*/
- (UIView *)customViewForEmptyDataSet:(UIScrollView *)scrollView
{
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[activityView startAnimating];
return activityView;
}
/**
* 返回动画
*/
- (CAAnimation *)imageAnimationForEmptyDataSet:(UIScrollView *)scrollView
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath: @"transform"];
animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 0.0, 0.0, 1.0)];
animation.duration = 0.25;
animation.cumulative = YES;
animation.repeatCount = MAXFLOAT;
return animation;
}
/**
* 设置图片和文字垂直方向的偏移量
*/
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
{
return -self.orderTableview.tableHeaderView.frame.size.height/2.0f;
}
/**
* 设置图片和文字之间的垂直间距
*/
- (CGFloat)spaceHeightForEmptyDataSet:(UIScrollView *)scrollView
{
return -64.0f;
}
#pragma mark - DZNEmptyDataSetDelegate Methods
/**
* 数据源为空时候是否渲染和显示(默认为YES);
*/
- (BOOL)emptyDataSetShouldDisplay:(UIScrollView *)scrollView
{
return YES;
}
/**
* 是否允许点击(默认为YES);
*/
- (BOOL)emptyDataSetShouldAllowTouch:(UIScrollView *)scrollView
{
return YES;
}
/**
* 是否允许滚动(默认为NO);
*/
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView
{
return NO;
}
/**
* 空白区域点击事件;
*/
- (void)emptyDataSet:(UIScrollView *)scrollView didTapView:(UIView *)view
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 按钮点击事件;
*/
- (void)emptyDataSet:(UIScrollView *)scrollView didTapButton:(UIButton *)button
{
UISearchBar *searchBar = self.searchDisplayController.searchBar;
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.com/apps/%@", searchBar.text]];
if ([[UIApplication sharedApplication] canOpenURL:URL]) {
[[UIApplication sharedApplication] openURL:URL];
}
}
DZNEmptyData设置
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 背景设置(参考前边rem布局代码理解) .div{ position:absolute; width:10rem;...