1

如何删除 Eureka 表单中单行的分隔线?

我想删除表格视图中的最后一行,即描述行下方的那一行。当我用常规的 tableview 寻找解决这个问题的方法时,最流行的解决方案是通过设置一个大的分隔符插入来将特定单元格的分隔线推出屏幕。像这样:

form.last! <<< TextAreaRow("description row") {
    $0.placeholder = "Description of the issue"
    $0.textAreaHeight = .dynamic(initialTextViewHeight: 44)
}.cellSetup{ cell, row in
    cell.separatorInset = UIEdgeInsets(top: 0, left: 2000, bottom: 0, right: 0)
}.onChange{ [weak self] in
    self?.issueMessage = $0.value ?? ""
}

我正在调用它viewDidLoad,但它似乎没有任何效果。我是尤里卡的新手。

尤里卡表单截图

4

2 回答 2

0

斯威夫特 4, 5

layoutSubview

public override func layoutSubviews() {
        super.layoutSubviews()
        for view in self.subviews where view != self.contentView {
            if NSStringFromClass(type(of: view)).contains("_UITableViewCellSeparatorView")
                view.removeFromSuperview()
            }
        }
    }
于 2021-03-02T01:45:09.943 回答
0

试试这个代码:

form.last! <<< TextAreaRow("description row") {
            $0.placeholder = "Description of the issue"
            $0.textAreaHeight = .dynamic(initialTextViewHeight: 44)
        }.cellSetup{ (cell, row) in
            if(row != 3) {
                cell.separatorInset = UIEdgeInsets(top: 0, left: 2000, bottom: 0, right: 0)
            }
        }.onChange{ [weak self] in
            self?.issueMessage = $0.value ?? ""
        }

我添加了检查(行!= 3),考虑到您只有 4 行,第 4 行的索引将是 3,因为它以 0 开头。

于 2017-01-02T18:28:55.950 回答