持续一段时间的Augustyniak / RATreeView Scroll UI问题

时间:2018-02-04 18:08:32

标签: ios swift treeview

当我使用动态计算的RATreeView单元格高度时,会出现滚动UI问题。 初始RATreeView控件设置

func setupTreeView() {
    treeView = RATreeView(frame: view.bounds)
    treeView.register(UINib(nibName: String(describing: EquipmentListCell.self), bundle: nil), forCellReuseIdentifier: String(describing: EquipmentListCell.self))
    treeView.register(UINib(nibName: String(describing: EquipmentChildCell.self), bundle: nil), forCellReuseIdentifier: String(describing: EquipmentChildCell.self))
    treeView.register(UINib(nibName: String(describing: EquipmentCollectionCellDetail.self), bundle: nil), forCellReuseIdentifier: String(describing: EquipmentCollectionCellDetail.self))
    treeView.register(UINib(nibName: String(describing: EquipmentLevelCell.self), bundle: nil), forCellReuseIdentifier: String(describing: EquipmentLevelCell.self))

    treeView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    treeView.delegate = self
    treeView.dataSource = self
    treeView.treeFooterView = UIView()
    treeView.estimatedRowHeight = 50

    treeView.backgroundView = loadingView
    view.addSubview(treeView)
}

例如,如果我使用这一切都很好

func treeView(_ treeView: RATreeView, heightForRowForItem item: Any) -> CGFloat {
     return 50
}

但是,我为treeView和特定条件设置了不同的高度 - 只需通过setup height = 0隐藏单元格。  在这里,我得到一个滚动issue

func treeView(_ treeView: RATreeView, heightForRowForItem item: Any) -> CGFloat {
    return stats.total.toInt() == 0 ? 0 : 50
}

这里也打开了GitHub issue

感谢任何帮助。

0 个答案:

没有答案