美文网首页
DZNEmptyDataSetView使用笔记

DZNEmptyDataSetView使用笔记

作者: 我是小胡胡分胡 | 来源:发表于2018-06-22 14:32 被阅读18次

    1, reloadData, endUpdates
    hook这两个方法, 注入自己的操作。

    dzn_reloadEmptyDataSet

    2,
    DZNEmptyDataSetView

    2种view,
    一种是customView,
    一种是自己创建的view
    图片, 标题,描述,按钮, view的tap手势, button的tap targe-action手势

    层级关系

    DZNEmptyDataSetView (增加手势)
    contentView内部子view:imageview ,titleLabel, _detailLabel, _button(增加手势)
    或者contentView内部子view:_customView

    _contentView.alpha = 0;

    所有View添加完毕后,设置约束
    setupConstraints

    加入到
        if (!view.superview) {
    
    //如果是tableview或者是collectionview需要加在他们的最里面, 不怕被别的子 view盖住吗?
                // Send the view all the way to the back, in case a header and/or footer is present, as well as for sectionHeaders or any other content
                if (([self isKindOfClass:[UITableView class]] || [self isKindOfClass:[UICollectionView class]]) && self.subviews.count > 1) {
                    [self insertSubview:view atIndex:0];
                }
                else {
    //如果是uiscrollview就直接加载在他内部的最上面
                    [self addSubview:view];
                }
            }
    
    
    

    3, 加载中时的状态,自己控制

    - (void)setLoading:(BOOL)loading
    {
        if (self.isLoading == loading) {
            return;
        }
        
        _loading = loading;
        
        [self.tableView reloadEmptyDataSet];
    }
    
    

    在重新刷新reloadEmptyDataSet方法,切换DZNEmptyDataSetView的显示效果样式

    相关文章

      网友评论

          本文标题:DZNEmptyDataSetView使用笔记

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