美文网首页
#import

#import

作者: 杯中怎可无酒 | 来源:发表于2019-08-22 19:51 被阅读0次
纯粹是为了粘代码方便而已
DZNEmptyDataSetSource,DZNEmptyDataSetDelegate
#pragma mark -
#pragma mark - 👉 DZNEmptyDataSetSource 👈

- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView {
    return YES;
}

- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
    return -120;
}

- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
    return kIconNamed(@"card_bag_invalid_card_img");
}

- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
    NSString *title = NSLocalizedString(@"暂时没有失效的卡", nil);
    NSDictionary *attributes = @{
                                 NSFontAttributeName:[UIFont dy_font14pt:DYFontBoldTypeRegular],
                                 NSForegroundColorAttributeName:[UIColor colorC5]
                                 };
    return [[NSAttributedString alloc] initWithString:title attributes:attributes];
}
#pragma mark -
#pragma mark - 👉 DZNEmptyDataSetSource 👈

- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
    return kIconNamed(@"bill_consume_img_record");
}

- (NSAttributedString *)buttonTitleForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state {
    NSString *text = @"没有找到相关记录,查看更多请 选择时间";

    NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:text];
    // 设置所有字体大小为 #15
    [attStr addAttribute:NSFontAttributeName
                   value:[UIFont dy_font12pt:DYFontBoldTypeRegular]
                   range:NSMakeRange(0, text.length)];
    // 设置所有字体颜色为浅灰色
    [attStr addAttribute:NSForegroundColorAttributeName
                   value:[UIColor colorC5]
                   range:NSMakeRange(0, text.length)];
    // 设置指定4个字体为蓝色
    [attStr addAttribute:NSForegroundColorAttributeName
                   value:[UIColor colorC1]
                   range:NSMakeRange(15, 4)];
    return attStr;
}

- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
    return -120.0f;
}

#pragma mark -
#pragma mark - 👉 DZNEmptyDataSetDelegate 👈

- (void)emptyDataSet:(UIScrollView *)scrollView didTapButton:(UIButton *)button {
    [self showDatePickerController];
}

- (void)emptyDataSetWillAppear:(UIScrollView *)scrollView {
    self.tableView.contentOffset = CGPointZero;
}
 _tableView.emptyDataSetDelegate = self;
 _tableView.emptyDataSetSource = self;

相关文章

网友评论

      本文标题:#import

      本文链接:https://www.haomeiwen.com/subject/eyvosctx.html